This is a sample code to perform Binarization of data using Techniques for Data Preprocessing :
import numpy as np
import sklearn.preprocessing
input_data = np.array([2.1, -1.9, 5.5],
[-1.5, 2.4, 3.5],
[0.5, -7.9, 5.6],
[5.9, 2.3, -5.8])
# Binarization of Data
data_binarized = preprocessing.binarizer(threshold = 0.5 ).transform(input_data)
print("\nBinarized Data\n", data_binarized)
This code gives an error:
array() takes from 1 to 2 positional arguments but 4 were given
How can I make arrays with more than one row ?
There should be one more pair of brackets, like this:
np.array([[2.1, -1.9, 5.5],
[-1.5, 2.4, 3.5],
[0.5, -7.9, 5.6],
[5.9, 2.3, -5.8]])
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments