You are passing floats to a classifier which expects categorical values as the target vector. If you convert it to int
it will be accepted as input (although it will be questionable if that’s the right way to do it).
It would be better to convert your training scores by using scikit’s labelEncoder
function.
The same is true for your DecisionTree and KNeighbors qualifier.
from sklearn import preprocessing from sklearn import utils lab_enc = preprocessing.LabelEncoder() encoded = lab_enc.fit_transform(trainingScores) >>> array([1, 3, 2, 0], dtype=int64) print(utils.multiclass.type_of_target(trainingScores)) >>> continuous print(utils.multiclass.type_of_target(trainingScores.astype('int'))) >>> multiclass print(utils.multiclass.type_of_target(encoded)) >>> multiclass
Related Posts:
- TypeError: only length-1 arrays can be converted to Python scalars while plot showing
- ValueError: Unknown label type: ‘continuous’
- Converting list to numpy array
- How to normalize a NumPy array to a unit vector?
- Syntax in Python (.T)
- How to normalize a NumPy array to a unit vector?
- Numpy/Python Array Value error
- Calculating Covariance with Python and Numpy
- Python reshape list to ndim array
- Python – TypeError: Object of type ‘int64’ is not JSON serializable
- How to implement the Softmax function in Python
- RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility
- Error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat) when running Python script
- Numpy float64 vs Python float
- Calculate the Cumulative Distribution Function (CDF) in Python
- Python can’t multiply sequence by non-int of type ‘float’
- ImportError in importing from sklearn: cannot import name check_build
- ImportError: DLL load failed: The specified module could not be found
- ImportError: DLL load failed: The specified module could not be found
- ValueError: setting an array element with a sequence
- ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
- What exactly does numpy.exp() do? [closed]
- numpy: Invalid value encountered in true_divide
- python numpy ValueError: operands could not be broadcast together with shapes
- How to fix ‘Object arrays cannot be loaded when allow_pickle=False’ for imdb.load_data() function?
- TypeError: unhashable type: ‘numpy.ndarray’
- XGBoost XGBClassifier Defaults in Python
- Plotting a 2D heatmap with Matplotlib
- Should I use np.absolute or np.abs?
- What does numpy.random.seed(0) do?
- What does the c underscore expression `c_` do exactly?
- ImportError: Missing required dependencies [‘numpy’]
- ModuleNotFoundError: No module named ‘sklearn’
- Error: all the input array dimensions except for the concatenation axis must match exactly
- How to find all occurrences of an element in a list
- TypeError: ‘numpy.float64’ object is not callable
- TypeError: ‘numpy.float64’ object is not callable
- Convert a tensor to numpy array in Tensorflow?
- ‘DataFrame’ object has no attribute ‘sort’
- ValueError: all the input arrays must have same number of dimensions
- ValueError: setting an array element with a sequence
- filename.whl is not a supported wheel on this platform
- ImportError: No module named sklearn (Python)
- Convert a tensor to numpy array in Tensorflow?
- How to raise a numpy array to a power? (corresponding to repeated matrix multiplications, not elementwise)
- What is dtype(‘O’), in pandas?
- How can I upgrade NumPy?
- What does numpy.gradient do?
- How can the Euclidean distance be calculated with NumPy?
- How to get element-wise matrix multiplication (Hadamard product) in numpy?
- ‘list’ object has no attribute ‘shape’
- What is dtype(‘O’), in pandas?
- ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)
- Overflow Error in Python’s numpy.exp function
- load csv into 2D matrix with numpy for plotting
- ValueError: ‘object too deep for desired array’
- Purpose of `numpy.log1p( )`?
- How to take column-slices of dataframe in pandas
- Pytorch tensor to numpy array
- ‘numpy.ndarray’ object has no attribute ‘index’
- ‘numpy.float64’ object is not iterable
- index 1 is out of bounds for axis 0 with size 1
- Normalize data in pandas
- Most efficient way to reverse a numpy array
- Can’t broadcast input array from shape (3,1) into shape (3,)
- Simple plot in python of a numpy array?
- deleting rows in numpy array
- Arrays used as indices must be of integer (or boolean) type
- How to normalize a 2-dimensional numpy array in python less verbose?
- Insert some string into given string at given index in Python
- Understanding NumPy’s einsum
- For loop and ‘numpy.float64’ object is not iterable error
- What are the causes of overflow encountered in double_scalars besides division by zero?
- How can I remove Nan from list Python/NumPy
- Python/Numpy MemoryError
- TypeError: Invalid dimensions for image data when plotting array with imshow()
- What’s the difference between scikit-learn and tensorflow? Is it possible to use them together?
- Moving average or running mean
- How to start from second index for for-loop
- Using numpy to build an array of all combinations of two arrays
- Can’t update to numpy 1.13 with anaconda?
- How to plot an array in python?
- TypeError: only integer arrays with one element can be converted to an index 3
- How to create a numpy array of all True or all False?
- Removing nan values from an array
- LinAlgError: Last 2 dimensions of the array must be square
- Building multi-regression model throws error: `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).`
- Root mean square of a function in python
- Can sklearn random forest directly handle categorical features?
- What are the differences between numpy arrays and matrices? Which one should I use?
- mean, nanmean and warning: Mean of empty slice
- Is there any numpy group by function?
- Replacing Pandas or Numpy Nan with a None to use with MysqlDB
- How to normalize a NumPy array to within a certain range?
- How to implement the ReLU function in Numpy
- Sorting arrays in NumPy by column
- Python/Scikit-Learn – Can’t handle mix of multiclass and continuous
- numpy : calculate the derivative of the softmax function
- Conditional indexing with Numpy ndarray
- python numpy machine epsilon