Comments¶
Transformations in
torchvision.transformswork on images, tensors (representing images) and possibly on numpy arrays (representing images). However, a transformation (e.g.,ToTensor) might work differently on different input types. So you'd be clear about what exactly a transformation function does. A good practice is to always convert your non-tensor input data to tensors using the transformationToTensor
Cluster Management Made Easy with Ansible
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Installation
sudo pip3 install ansible
Configuration
Ansible looks for configuration file in the following order.
-
ansible.cfgin the current directory. -
~/.ansible.cfg -
/etc/ansible.cfg
Examples
Copy a file to …
Cluster Management Made Easy with the Python Package Fabric
Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Ansible is a better alternative to Fabric. It is suggested that you use Ansible instead.
-
Docstring will be displayed when you type the command
fab -l. -
Invoke is for local use …
Hands on pandas.Series in Python
pandas.Series.str¶
The attribute
pandas.Series.strcan only be used with Series ofstrvalues. You will either encounter anAttributionError(Can only use .str accessor with string values, which use np.object_ dtype in pandas) or find it to yield a Series ofNaN's if you invoke it on a Series of non-string values. If you have control of the DataFrame, the preferred way is to cast the type the column tostr
Hands on the Python module random
Split a Dataset into Train and Test Datasets in Python
Scikit-learn Compatible Packages¶
sklearn.model_selection.train_test_split
is the best way to split a dataset into train and test subset
for scikit-learn compatible packages (scikit-learn, XGBoost, LightGBM, etc.).
It supports splitting both iterable objects (numpy array, list, pandas Series) and pandas DataFrames.
When splitting an iterable object,
it returns (train, test) where train and test are lists.
When splitting a pandas DataFrame,
it returns (train, test)