-
Notifications
You must be signed in to change notification settings - Fork 0
/
Usage.py
88 lines (61 loc) · 2.52 KB
/
Usage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from subprocess import call
import os
import support_functions as sup
# Path of dataset file
data_path = os.path.join("dataset_small", "u.data")
# Does the dataset have a header line?
has_header = "0"
# Column separator of the dataset file
separator = "\t"
# Path to output processed data
output_path = "data"
# Number of folds for the k-fold cross-validation
folds_number = "5"
# Path for the clustered data
kmeans_path = os.path.join(output_path, 'kmeans')
# Running the 1st script for data sampling
py_file = "01_data_split_function.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, data_path, has_header, separator, output_path])
print "" # Break line
# Running the 2nd script for clustering computing
py_file = "02_k-means.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path])
print "" # Break line
# Running the 3rd script for fitting test data into clusters
py_file = "03_finding_clusters.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number, kmeans_path])
print "" # Break line
# Running the 4th set of scripts for computing similarity matrices for all models
py_file = "04_kmeans_similarity_matrices.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number])
print "" # Break line
py_file = "04_knn_similarity_matrices.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number])
print "" # Break line
# Running the 5th set of scripts for predicting ratings for all models
py_file = "05_kmeans_nonzero_predict.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number])
print "" # Break line
py_file = "05_knn_nonzero_predict.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number])
print "" # Break line
# Running the 6th set of scripts for predicting ratings
py_file = "06_kmeans_evaluate_predictions.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number])
print "" # Break line
py_file = "06_knn_evaluate_predictions.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number])
print "" # Break line
# Running the 7th script for computing the linear weighted hybrid coefficients
py_file = "07_compute_evaluate_hybrid.py"
sup.logmsg("Running '{}' script".format(py_file))
call(["python", py_file, output_path, folds_number])