how to create the dotted line in the below NumPy array bh=make_figure(b,’gh’) requirement: how to convert element 1 into 0 with the step of two expected outputs is like I tried with a brute force algorithm, but I am not able to find the solution output array looks like for visual representation like making a dotted line Answer Here’s one
I am applying selectKbest feature selection technique but it is giving me the following error: here is the portion of my code: (Note: the original data is in CSV format) Answer X is a numpy array, and you can only call the .columns method on a dataframe. You need to convert to a dataframe first, then call the method.
for a example: I have array a my current code Current output: Required output: 1)If i return the variable border in the above function it onlx gives the value of first array, so its returns both the arrays with print function. 2)How to combine both the array like mentioned below expected ouput Answer You could use an array to collect
I can easily train and test a classifier using the code below. Now, how can I make a prediction of the target variable (dependent variable) based on the independent variables? Something like this should work, I think, but it doesn’t… If we leave numerics as numerics, and put quotes around labels, I would like to predict the dependent variable, but
This is a beginner level question on scikit learn’s test-train split module. I am working trying to feed in 2 inputs to the input layer of my neural network, but I am not able to get the input matrix’s dimensions correct! What change I should implement to get this working! X1 and X2 are my inputs and y is my
I have created a pipeline using sklearn so that multiple models will go through it. Since there is vectorization before fitting the model, I wonder if this vectorization is performed always before the model fitting process? If yes, maybe I should take this preprocessing out of the pipeline. Answer When you are running a GridSearchCV, pipeline steps will be recomputed
When testing a PMML object previously converted from a Pickle file (dumped from a sklearn fitted object), I am unable to reproduce the same results as with the pickle model. In the sklearn we see I obtain [0 1 0] as classes for the input given in X. However in PMML I would approaximate the probabilities to [1 1 1].
I am selecting best features and then doing grid search. When finished, I want to print the best features that have been selected. When trying to print with I get the following error Ive also tried but have gotten an error. Answer The grid search clones its estimator before fitting, so your pipe itself remains unfitted. You can access the
Answer You provide a scalar value to .predict method. You need to provide a 2-dimensional array:
I’m trying to finds the best estimator using GridSearchCV and I’m using refit = True as per default. Given that the documentation states: Should I do .fit on the training data afterwards as such: Or should I do it like this instead: Answer You should do it like your first verison. You need to always call classifier.fit otherwise it doesn’t