Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char **argv)
- {
- std::string filename = argv[1]; // dosya isimi
- svm_problem* problem = parse_train_data(filename); // veriden problem olustur
- svm_parameter param;
- // parametreler
- param.svm_type = C_SVC;
- param.kernel_type = RBF;
- param.degree = 3;
- param.gamma = 0;
- param.coef0 = 0;
- param.nu = 0.5;
- param.cache_size = 100;
- param.C = 1;
- param.eps = 1e-3;
- param.p = 0.1;
- param.shrinking = 1;
- param.probability = 0;
- param.nr_weight = 0;
- param.weight_label = NULL;
- param.weight = NULL;
- // modeli egit
- svm_model *model = svm_train(problem, ¶m);
- // 6.7 3.3 5.7 2.5 -> rastgele bir veri
- double data[4] = {6.5, 3.2, 5.1, 2.0};
- svm_node *query_data = new svm_node[4]; // SVM NODE formatina sok
- for (int i = 0; i < 4; i++)
- {
- query_data[i].index = i;
- query_data[i].value = data[i];
- }
- // Tahmin yurut(predict)
- std::cout << "Sonuc:" << svm_predict(model, query_data) << std::endl;
- svm_save_model("model", model); // modeli kaydet
- // Bellekten alinanlari sil
- svm_free_and_destroy_model(&model);
- delete query_data
- delete problem->y;
- for(int i = 0;i < problem->l;i++)
- {
- delete problem->x[i];
- }
- delete problem->x;
- delete problem;
- return 0;
- }
Add Comment
Please, Sign In to add comment