I have a simple dataset which looks like this: I created a simple LR model to train and predict the target variable “sales”. And I used MAE to evaluate the model My code works well, but what I want to do is to predict the sales in the X_test grouped by hour of the day. In the above dataset example,
Tag: machine-learning
name ‘Bidirectional’ is not defined
Im following this tutorial and right when I want to initialize a sequential keras, like the code below: I get an error saying : What is the problem ? it is the exact same code as in the tutorial. Answer You’re most likely missing the import statement from the tensorflow package. It appears that’s there is a link to the
How to find contours in dotted text captcha image
I am newbie to OpenCV. I’m trying to find the contours of the captcha image. It does not work only when my captcha image contains the dotted text. I have done following code for that: Can anyone help in this? Is there any way to find contours in this image? Answer Here is my code and output
How to put importance coefficients to features before kmeans?
Lets say I have the given dataframe And I would like to find clusters in these rows. To do so, I want to use Kmeans. However, I would like to find clusters by giving more importance to [feature_1, feature_2] than to the other features in the dataframe. Lets say an importance coefficient of 0.5 for [feature_1, feature_2] , and 0.5
model plots – confusion matrix – Accuracy plot
In my code I’m plotting the accuracy curve plot and the confusion matrix heat map. However: 1- I’m getting both plots on one (picture below) 2- Why is the number apering this way ? In my heat map, I need the numbers and the percentages. The code Answer After this row: add a new row:
Remove outlier using quantile python
I need to remove outlier for a regression dataset. Lets say the dataset is consist in the following way With closer inspection, the column humidity has three outliers which are 50.0,18.0,0.01 but for windspeed column the outliers are 20 and 0.05 and both columns outliers are not in the same row. In this case if I remove my outlier with
Add features to the “numeric” dataset whose categorical value must be mapped using a conversion formula
I have this dataset: This is the request: “Add the Mjob and Fjob attributes to the “numeric” dataset whose categorical value must be mapped using a conversion formula of your choice.” Does anyone knows how to do it? For example: if ‘at_home’ value become ‘1’ in Mjob, I want the same result in the Fjob column. Same categorical values must
Is it possible to optimize hyperparameters for optional sklearn pipeline steps?
I tried to construct a pipeline that has some optional steps. However, I would like to optimize hyperparameters for those steps as I want to get the best option between not using them and using them with different configurations (in my case SelectFromModel – sfm). The error that I get is ‘string’ object has no attribute ‘set_params’ which is understandable.
trying to callibrate keras model
I’m trying to calibrate my CNN model by Sklearn implementation CalibratedClassifierCV, tried to wrap it as KerasClassifier and to override the predict function but without success. someone could say me what I did wrong? this is the model code: this is me trying to calibrate it : the output : valX_cnn and val_y_cnn are of type np.array. tried even to
TensorFlow TextVectorization producing Ragged Tensor with no padding after loading it from pickle
I have a TensorFlow TextVectorization layer named “eng_vectorization”: and I saved it in a pickle file, using this code: Then I load that pickle file properly as new_eng_vectorization: Now I am expecting, both previous vectorization eng_vectorization and newly loaded vectorization new_eng_vectorization to work the same, but they are not. The output of original vectorization, eng_vectorization([‘Hello people’]) is a Tensor: And