我对机器学习算法和分类技术还比较陌生。
我已经创建了一个数据集,并使用Python中的sklearn
模块训练了一个SVM
模型。
但现在我需要将我的方法从SVM
更改为人工免疫系统
。因此我的问题是,在Python中有没有可以使用的AIS模块?就像Sklearn
提供SVM
一样。
如果没有,哪里可以找到实现它的示例或帮助?
以下是我在SVM
中的代码,以防有人需要。
# In the name of GOD# SeyyedMahdi Hassanpour# [email protected]# SeyyedMahdihp @ githubimport numpy as npfrom sklearn import svm, model_selectionimport pandas as pddf = pd.read_csv('final_dataset123456.csv')x = np.array(df.drop(['label'], 1))y = np.array(df['label'])x_train, x_test, y_train, y_test = model_selection.train_test_split(x, y, test_size=0.36, random_state=39)clf = svm.SVC()clf.fit(x_train, y_train)accuracy = clf.score(x_test, y_test)print(accuracy)ar = [0,0,0,0,0,0,0,0,0,0,0,0,0.2,0.058824,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.25,0,0,0,0,0.020833,0.2,0.090909,0,0.032258,0,0,0,0,0,0.0625,0,0,0,0.058333,0,0,0.1,0,0.125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]br = [0.5,1,1,0.254902,0.853933,1,1,0.254902,1,0.27451,0.2,1,0.4,0.176471,1,1,1,1,0.625,1,0.125,1,0.393939,0.857143,0.052632,1,0.75,0.847826,1,1,0.583333,0.7,1,1,1,0.729167,0.6,0.818182,1,0.193548,0.333333,1,0.674419,1,1,1,0.8,1,1,0.2,0.37037,1,0.8,0.529412,0.375,1,1,0.23913,1,1,1,1,0.666667,1,1,1,1,0,1,0,1,0.23913,0.7,0.7,1,1,1,1,1,1,1,1,0.23913,1,1,1,1,1,1,1,1,1,0.666667,1,0.7,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1]example_measures = np.array([ar,br])example_measures = example_measures.reshape(len(example_measures), -1)prediction = clf.predict(example_measures)print(prediction)
回答:
在WEKA平台上实现了许多人工免疫系统应用。你可以从sourceforge下载并使用它。这里是链接:https://sourceforge.net/directory/?q=artificial+immune+system