当前位置:首页>综合>正文

如何导入mlpy模块在python

2023-07-07 16:57:40 互联网 未知 综合

 如何导入mlpy模块在python

如何导入mlpy模块在python

首先pip install mlpy
安装这个模块
然后
Load the modules:
>>> import numpy as np
>>> import mlpy
>>> import matplotlib.pyplot as plt # required for plotting

Load the Iris dataset:
>>> iris = np.loadtxt(iris.csv, delimiter=,)
>>> x, y = iris[:, :4], iris[:, 4].astype(np.int) # x: (observations x attributes) matrix, y: classes (1: setosa, 2: versicolor, 3: virginica)
>>> x.shape
(150, 4)
>>> y.shape
(150, )