I am following a this tutorial to write a Naive Bayes Classifier: http://machinelearningmastery.com/naive-bayes-classifier-scratch-python/ I keep getting this error: dataset[i] = [float(x) for x in dataset[i]] ValueError: could not convert string to float: Here is the part of my code where ...
Discy Latest Questions
So I am new to machine learning and was trying out the TensorFlow Linear Model Tutorial given here: https://www.tensorflow.org/tutorials/wide I literally just downloaded their tutorial and tried to run it in my computer but I got the error: AttributeError: module ...
I am building an image processing classifier. This line is giving me an error: input_img_resize=cv2.resize(input_img,(128,128)) The error: ('error: /io/opencv/modules/imgproc/src/imgwarp.cpp:3483: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize') My code: PATH = os.getcwd() # Define data path data_path = PATH + '/data' data_dir_list = os.listdir(data_path) img_rows=128 img_cols=128 num_channel=3 num_epoch=30 num_classes ...
I try to apply this code : pipe = make_pipeline(TfidfVectorizer(min_df=5), LogisticRegression()) param_grid = {'logisticregression__C': [ 0.001, 0.01, 0.1, 1, 10, 100], "tfidfvectorizer__ngram_range": [(1, 1),(1, 2),(1, 3)]} grid = GridSearchCV(pipe, ...
import numpy as np import pandas as pd import matplotlib.pyplot as pt data1 = pd.read_csv('stage1_labels.csv') X = data1.iloc[:, :-1].values y = data1.iloc[:, 1].values from sklearn.preprocessing import LabelEncoder, OneHotEncoder label_X = LabelEncoder() X[:,0] = label_X.fit_transform(X[:,0]) encoder = OneHotEncoder(categorical_features = [0]) X = encoder.fit_transform(X).toarray() from sklearn.cross_validation import train_test_split X_train, X_test, y_train,y_test = train_test_split(X, y, ...
Trying to plot the decision Boundary of the k-NN Classifier but is unable to do so getting TypeError: ‘(slice(None, None, None), 0)’ is an invalid key` h = .01 # step size in the mesh ...
I’m a beginner to python and machine learning . I get below error when i try to fit data into statsmodels.formula.api OLS.fit() Traceback (most recent call last): File “”, line 47, in regressor_OLS = sm.OLS(y , ...
I’m running a Keras neural network model in Jupyter Notebook (Python 3.6) I get the following error AttributeError: ‘list’ object has no attribute ‘ndim’ after calling the .fit() method from Keras.model model = Sequential() model.add(Dense(5, input_dim=len(X_data[0]), activation='sigmoid' )) model.add(Dense(1, activation = 'sigmoid')) model.compile(loss='mean_squared_error', optimizer='adam', metrics=['acc']) model.fit(X_data, y_data, ...
I was using the Decision Tree and this error was raised. The same situation appeared when I used Back Propagation. How can I solve it? import pandas as pd import numpy as np a = np.test() f = open('E:/lgdata.csv') data = pd.read_csv(f,index_col = 'id') x = ...
I’m following this tutorial to make this ML prediction: import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use("ggplot") from sklearn import svm x = [1, 5, 1.5, 8, 1, 9] y = [2, 8, 1.8, 8, 0.6, 11] plt.scatter(x,y) plt.show() X = np.array([[1,2], ...