Google Colaboratory: misleading information about its GPU (only 5% RAM available to some users)

So to prevent another dozen of answers suggesting invalid in the context of this thread suggestion to !kill -9 -1, let’s close this thread: The answer is simple: As of this writing Google simply gives only 5% of GPU to some of us, whereas 100% to the others. Period. dec-2019 update: The problem still exists … Read more

What are the pros and cons between get_dummies (Pandas) and OneHotEncoder (Scikit-learn)?

For machine learning, you almost definitely want to use sklearn.OneHotEncoder. For other tasks like simple analyses, you might be able to use pd.get_dummies, which is a bit more convenient. Note that sklearn.OneHotEncoder has been updated in the latest version so that it does accept strings for categorical variables, as well as integers. The crux of … Read more

Can anyone explain me StandardScaler?

Intro I assume that you have a matrix X where each row/line is a sample/observation and each column is a variable/feature (this is the expected input for any sklearn ML function by the way — X.shape should be [number_of_samples, number_of_features]). Core of method The main idea is to normalize/standardize i.e. μ = 0 and σ … Read more

memory issues when transforming np.array using to_categorical

You don’t need to use to_categorical since I guess you are doing multi-label classification. To avoid any confusion once and for all(!), let me explain this. If you are doing binary classification, meaning each sample may belong to only one of two classes e.g. cat vs dog or happy vs sad or positive review vs … Read more

How to process requests from multiiple users using ML model and FastAPI?

First, you should rather not load your model every time a request arrives, but rahter have it loaded once at startup (you could use the startup event for this) and store it on the app instance—using the generic app.state attribute (see implementation of State too)—which you can later retrieve, as described here and here. For … Read more

Tensorflow (.pb) format to Keras (.h5)

In the Latest Tensorflow Version (2.2), when we Save the Model using tf.keras.models.save_model, the Model will be Saved in not just a pb file but it will be Saved in a Folder, which comprises Variables Folder and Assets Folder, in addition to the saved_model.pb file, as shown in the screenshot below: For example, if the … Read more