我是SVM領域的新手,並且正在嘗試通過教程來教導自己。我最近試圖創建一個樣本svm測試,但是,run-time
似乎是無止境的。考慮到我的dataframe
有7976行,典型的處理時間是多少?使用SVM處理時間
import numpy as np
from sklearn import svm
from sklearn import preprocessing
import pandas as pd
import os
directory_name = 'D:\Timothy\Practice SVM\Data'
name_of_file = 'Sample_SVM.csv'
df_start = pd.read_csv(os.path.join(directory_name, name_of_file))
df_cleaned = df_start.dropna()
X = df_cleaned.ix[1:8000, 'Sun'].as_matrix()
X = X.reshape((7976,1)) #unsure if this step is needed
X_test = df_cleaned.ix[8000:9913, 'Sun'].as_matrix()
y = df_cleaned.ix[1:8000, 'Meter_Total'].as_matrix()
y_test = df_cleaned.ix[8000:9913, 'Meter_Total'].as_matrix()
model = svm.SVC(kernel='linear', C=1, gamma=1)
model.fit(X,y)
model.score(X, y)
predicted = model.predict(X_test)
您的數據是否正常化? – hashcode55