Nov-10-2020, 10:16 AM
Hi, I have the data(example below) with floats and the last column is a string, that will be used in logistic regression assignment.
5.1 3 1.1 Iris-versicolor
5.7 4.1 1.3 Iris-versicolor
6.3 6 2.5 Iris-virginica
5.8 5.1 1.9 Iris-virginica
This is requested: "Use the numpy loadtxt() function, along with the 'converters' argument to change the labels from strings to the floats 0 and 1. Give the argument encoding=“utf8”, otherwise your converter function will need to additionally convert from bytes to strings."
Only packages I can use are:
numpy
matplotlib.pyplot
from mpl_toolkits.mplot3d import Axes3D
This is given as a template:
converter = {}
data = np.loadtxt(path, , conv=converter)
Can someone help how to use this "converters"? Thank you!
5.1 3 1.1 Iris-versicolor
5.7 4.1 1.3 Iris-versicolor
6.3 6 2.5 Iris-virginica
5.8 5.1 1.9 Iris-virginica
This is requested: "Use the numpy loadtxt() function, along with the 'converters' argument to change the labels from strings to the floats 0 and 1. Give the argument encoding=“utf8”, otherwise your converter function will need to additionally convert from bytes to strings."
Only packages I can use are:
numpy
matplotlib.pyplot
from mpl_toolkits.mplot3d import Axes3D
This is given as a template:
converter = {}
data = np.loadtxt(path, , conv=converter)
Can someone help how to use this "converters"? Thank you!