Commit 6fa32eb8 authored by Antoine PIGEAU's avatar Antoine PIGEAU
Browse files

add LR best features for each course + set script for NN Oulad merged

parent 4a3d4681
......@@ -86,11 +86,22 @@ class ExportBestFeature(Export):
s3= "BEST_LR_FEATURE_ALL_COURSES = { "
for idCourse in list(self.dictBestFeature.keys())[0:-1]:
strIdCourse = idCourse.replace('-', '_')
if(self.dictNameAttribute is None):
strIdCourse = idCourse.replace('-', '_')
else:
strIdCourse = self.dictNameAttribute[idCourse]
s3 += "ConstantModel."+strIdCourse+": "+BEST_LR_FEATURE+strIdCourse+ALL_PERIODS+","
idCourse = list(self.dictBestFeature.keys())[-1]
strIdCourse = idCourse.replace('-', '_')
if(self.dictNameAttribute is None):
strIdCourse = idCourse.replace('-', '_')
else:
strIdCourse = self.dictNameAttribute[idCourse]
s3 += "ConstantModel."+strIdCourse+": "+BEST_LR_FEATURE+strIdCourse+ALL_PERIODS+"}"
fileResult.write(s3)
......
......@@ -62,11 +62,8 @@ class Constant(ConstantInterface):
IMPLEMENTED_FEATURES_BEST_LR_25_EDM = [4, 7, 8, 10, 11]
IMPLEMENTED_FEATURES_BACKWARD_BEST_LR_100 = [7, 6, 12, 28, 8, 10, 14, 11, 27, 30, 9, 5]
IMPLEMENTED_FEATURES_BACKWARD_BEST_LR_75 = [7, 14, 30, 32, 9, 27]
IMPLEMENTED_FEATURES_BACKWARD_BEST_LR_50 = [27, 7, 28]
IMPLEMENTED_FEATURES_BACKWARD_BEST_LR_25 = [7, 14, 19, 22, 30, 35, 9, 13, 23, 36, 4, 12, 15, 18, 20, 21, 28]
IMPLEMENTED_FEATURES_BACKWARD_BEST_LR = { 25 : IMPLEMENTED_FEATURES_BACKWARD_BEST_LR_25,
......@@ -92,6 +89,7 @@ class Constant(ConstantInterface):
Best features for each course independently
'''
'''
BEST_LR_FEATURE_ARDUINO_25 = [0, 1, 7, 9, 12, 14, 15, 16, 17, 19, 20, 22, 26, 30, 32, 35, 36]
BEST_LR_FEATURE_ARDUINO_50 = [27]
BEST_LR_FEATURE_ARDUINO_75 = [9, 10, 14, 27, 28, 30]
......@@ -225,6 +223,94 @@ class Constant(ConstantInterface):
ConstantModel.COURSE_ID_TWITTER: BEST_LR_FEATURE_TWITTER_ALL_PERIODS,
ConstantModel.COURSE_ID_WEB: BEST_LR_FEATURE_WEB_ALL_PERIODS,
ConstantModel.COURSE_ID_XML: BEST_LR_FEATURE_XML_ALL_PERIODS}
'''
BEST_LR_FEATURE_COURSE_ID_JAVA_25 = [27, 37, 3]
BEST_LR_FEATURE_COURSE_ID_JAVA_50 = [27, 22, 34, 8, 18, 3]
BEST_LR_FEATURE_COURSE_ID_JAVA_75 = [27, 13, 19]
BEST_LR_FEATURE_COURSE_ID_JAVA_100 = [7]
BEST_LR_FEATURE_COURSE_ID_JAVA_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_JAVA_25, 50:BEST_LR_FEATURE_COURSE_ID_JAVA_50, 75:BEST_LR_FEATURE_COURSE_ID_JAVA_75, 100:BEST_LR_FEATURE_COURSE_ID_JAVA_100}
BEST_LR_FEATURE_COURSE_ID_XML_25 = [27, 22, 30]
BEST_LR_FEATURE_COURSE_ID_XML_50 = [27, 19]
BEST_LR_FEATURE_COURSE_ID_XML_75 = [7]
BEST_LR_FEATURE_COURSE_ID_XML_100 = [7]
BEST_LR_FEATURE_COURSE_ID_XML_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_XML_25, 50:BEST_LR_FEATURE_COURSE_ID_XML_50, 75:BEST_LR_FEATURE_COURSE_ID_XML_75, 100:BEST_LR_FEATURE_COURSE_ID_XML_100}
BEST_LR_FEATURE_COURSE_ID_IONIC_25 = [27, 1]
BEST_LR_FEATURE_COURSE_ID_IONIC_50 = [27, 15]
BEST_LR_FEATURE_COURSE_ID_IONIC_75 = [27]
BEST_LR_FEATURE_COURSE_ID_IONIC_100 = [27]
BEST_LR_FEATURE_COURSE_ID_IONIC_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_IONIC_25, 50:BEST_LR_FEATURE_COURSE_ID_IONIC_50, 75:BEST_LR_FEATURE_COURSE_ID_IONIC_75, 100:BEST_LR_FEATURE_COURSE_ID_IONIC_100}
BEST_LR_FEATURE_COURSE_ID_RUBY_25 = [4]
BEST_LR_FEATURE_COURSE_ID_RUBY_50 = [21]
BEST_LR_FEATURE_COURSE_ID_RUBY_75 = [7, 0, 27, 19]
BEST_LR_FEATURE_COURSE_ID_RUBY_100 = [7]
BEST_LR_FEATURE_COURSE_ID_RUBY_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_RUBY_25, 50:BEST_LR_FEATURE_COURSE_ID_RUBY_50, 75:BEST_LR_FEATURE_COURSE_ID_RUBY_75, 100:BEST_LR_FEATURE_COURSE_ID_RUBY_100}
BEST_LR_FEATURE_COURSE_ID_NODE_JS_25 = [27, 18, 21]
BEST_LR_FEATURE_COURSE_ID_NODE_JS_50 = [27, 11, 7]
BEST_LR_FEATURE_COURSE_ID_NODE_JS_75 = [27, 7, 35, 21]
BEST_LR_FEATURE_COURSE_ID_NODE_JS_100 = [11]
BEST_LR_FEATURE_COURSE_ID_NODE_JS_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_NODE_JS_25, 50:BEST_LR_FEATURE_COURSE_ID_NODE_JS_50, 75:BEST_LR_FEATURE_COURSE_ID_NODE_JS_75, 100:BEST_LR_FEATURE_COURSE_ID_NODE_JS_100}
BEST_LR_FEATURE_COURSE_ID_ARDUINO_25 = [27, 17, 26]
BEST_LR_FEATURE_COURSE_ID_ARDUINO_50 = [27, 7]
BEST_LR_FEATURE_COURSE_ID_ARDUINO_75 = [27, 21]
BEST_LR_FEATURE_COURSE_ID_ARDUINO_100 = [7, 30]
BEST_LR_FEATURE_COURSE_ID_ARDUINO_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_ARDUINO_25, 50:BEST_LR_FEATURE_COURSE_ID_ARDUINO_50, 75:BEST_LR_FEATURE_COURSE_ID_ARDUINO_75, 100:BEST_LR_FEATURE_COURSE_ID_ARDUINO_100}
BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_25 = [27, 34]
BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_50 = [27, 22]
BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_75 = [27, 30, 16, 5]
BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_100 = [7, 32, 13]
BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_25, 50:BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_50, 75:BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_75, 100:BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_100}
BEST_LR_FEATURE_COURSE_ID_AUDACE_25 = [27, 30, 33, 37]
BEST_LR_FEATURE_COURSE_ID_AUDACE_50 = [11, 33, 35]
BEST_LR_FEATURE_COURSE_ID_AUDACE_75 = [7, 9, 1]
BEST_LR_FEATURE_COURSE_ID_AUDACE_100 = [7, 37]
BEST_LR_FEATURE_COURSE_ID_AUDACE_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_AUDACE_25, 50:BEST_LR_FEATURE_COURSE_ID_AUDACE_50, 75:BEST_LR_FEATURE_COURSE_ID_AUDACE_75, 100:BEST_LR_FEATURE_COURSE_ID_AUDACE_100}
BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_25 = [27, 22]
BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_50 = [27, 7, 8]
BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_75 = [27, 7, 6, 37]
BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_100 = [7, 33]
BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_25, 50:BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_50, 75:BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_75, 100:BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_100}
BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_25 = [27, 11]
BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_50 = [27, 6, 9]
BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_75 = [7, 25]
BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_100 = [7, 16, 27, 20]
BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_25, 50:BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_50, 75:BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_75, 100:BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_100}
BEST_LR_FEATURE_COURSE_ID_TWITTER_25 = [27, 33, 15]
BEST_LR_FEATURE_COURSE_ID_TWITTER_50 = [27, 30, 7, 19, 1]
BEST_LR_FEATURE_COURSE_ID_TWITTER_75 = [7, 32, 0, 30, 17]
BEST_LR_FEATURE_COURSE_ID_TWITTER_100 = [7, 27, 16, 4]
BEST_LR_FEATURE_COURSE_ID_TWITTER_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_TWITTER_25, 50:BEST_LR_FEATURE_COURSE_ID_TWITTER_50, 75:BEST_LR_FEATURE_COURSE_ID_TWITTER_75, 100:BEST_LR_FEATURE_COURSE_ID_TWITTER_100}
BEST_LR_FEATURE_COURSE_ID_WEB_25 = [27, 12]
BEST_LR_FEATURE_COURSE_ID_WEB_50 = [27, 7, 6, 22]
BEST_LR_FEATURE_COURSE_ID_WEB_75 = [7, 25, 6, 9]
BEST_LR_FEATURE_COURSE_ID_WEB_100 = [7, 20, 27, 33]
BEST_LR_FEATURE_COURSE_ID_WEB_ALL_PERIODS = { 25:BEST_LR_FEATURE_COURSE_ID_WEB_25, 50:BEST_LR_FEATURE_COURSE_ID_WEB_50, 75:BEST_LR_FEATURE_COURSE_ID_WEB_75, 100:BEST_LR_FEATURE_COURSE_ID_WEB_100}
BEST_LR_FEATURE_ALL_COURSES = {
ConstantModel.COURSE_ID_JAVA: BEST_LR_FEATURE_COURSE_ID_JAVA_ALL_PERIODS,
ConstantModel.COURSE_ID_XML: BEST_LR_FEATURE_COURSE_ID_XML_ALL_PERIODS,
ConstantModel.COURSE_ID_IONIC: BEST_LR_FEATURE_COURSE_ID_IONIC_ALL_PERIODS,
ConstantModel.COURSE_ID_RUBY: BEST_LR_FEATURE_COURSE_ID_RUBY_ALL_PERIODS,
ConstantModel.COURSE_ID_NODE_JS: BEST_LR_FEATURE_COURSE_ID_NODE_JS_ALL_PERIODS,
ConstantModel.COURSE_ID_ARDUINO: BEST_LR_FEATURE_COURSE_ID_ARDUINO_ALL_PERIODS,
ConstantModel.COURSE_ID_BOOTSTRAP: BEST_LR_FEATURE_COURSE_ID_BOOTSTRAP_ALL_PERIODS,
ConstantModel.COURSE_ID_AUDACE: BEST_LR_FEATURE_COURSE_ID_AUDACE_ALL_PERIODS,
ConstantModel.COURSE_ID_JAVA_SCRIPT: BEST_LR_FEATURE_COURSE_ID_JAVA_SCRIPT_ALL_PERIODS,
ConstantModel.COURSE_ID_GESTION_PROJET: BEST_LR_FEATURE_COURSE_ID_GESTION_PROJET_ALL_PERIODS,
ConstantModel.COURSE_ID_TWITTER: BEST_LR_FEATURE_COURSE_ID_TWITTER_ALL_PERIODS,
ConstantModel.COURSE_ID_WEB: BEST_LR_FEATURE_COURSE_ID_WEB_ALL_PERIODS}
'''
SVM
......
......@@ -218,4 +218,5 @@ class Constant(ConstantInterface):
Perceptron Neural Network
'''
HIDDEN_LAYERS_BEST_NN_PERCEPTRON = [128, 256]
\ No newline at end of file
HIDDEN_LAYERS_BEST_NN_PERCEPTRON = [128, 256]
#HIDDEN_LAYERS_BEST_NN_PERCEPTRON_MERGED =
\ No newline at end of file
......@@ -42,10 +42,10 @@ if __name__ == "__main__":
classifier = Classifier(idCourses = ConstantModel.ID_COURSES,
nameGroups = [ConstantModel.GROUP_SUCCEED_ALL_USERS, ConstantModel.GROUP_FAILED_ALL_USERS],
features = ConstantFeature.IMPLEMENTED_FEATURES,
features = None,
typeFeatureGroup = ConstantFeature.TYPE_FEATURE_GROUP,
hiddenLayers = None,
featuresByCourse = None, #ConstantFeature.BEST_LR_FEATURE_ALL_COURSES,
featuresByCourse = ConstantFeature.BEST_LR_FEATURE_ALL_COURSES,
featuresByPeriod = None)
# classifier = Classifier(idCourses=ConstantModel.ID_COURSES,
......@@ -96,7 +96,7 @@ if __name__ == "__main__":
''' for all periods '''
#classifier.predictionTaskForAllPeriods(ntime=10)
classifier.predictionTaskForAllPeriods(ntime=10)
''' NN : all courses with hidden layers'''
......@@ -116,7 +116,7 @@ if __name__ == "__main__":
Warning: SVM is very slow if the AUC criterion is used
'''
'''
dictBestFeature = {}
......@@ -148,6 +148,8 @@ if __name__ == "__main__":
exportBestFeature.export()
'''
stopTime = datetime.now()
print(("end of the process boosting ("+str(stopTime-startTime)+")"))
......@@ -23,7 +23,7 @@ This file is part of Hubble-UserProfile.
from datetime import datetime
from classifierManager.oulad.classifier import Classifier
from classifierManager.constant import Constant as ConstantClassifier
from classifierManager.constant import Constant as ConstantClassifier, Constant
from featureManager.oulad.constant import Constant as ConstantFeature
......@@ -39,15 +39,15 @@ if __name__ == "__main__":
classifier = Classifier(idCourses = ConstantModel.ID_COURSES_ALL,
directory = Classifier.DIRECTORY_EXPERIMENT_MERGED,
nameGroups = [ConstantModel.GROUP_ALL_GRADED, ConstantModel.GROUP_ALL_UNGRADED],
features = None, #ConstantFeature.IMPLEMENTED_FEATURES,
featuresByPeriod=ConstantFeature.BEST_LR_FEATURE_MERGED_ALL_PERIODS,
features = ConstantFeature.IMPLEMENTED_FEATURES,
featuresByPeriod= None, #ConstantFeature.BEST_LR_FEATURE_MERGED_ALL_PERIODS,
typeFeatureGroup = ConstantFeature.TYPE_FEATURE_GROUP,
hiddenLayers = None,
featuresByCourse= None)
classifier.setScriptClassifier(ConstantClassifier.LogisticRegression)
classifier.setScriptClassifier(ConstantClassifier.Perceptron)
'''
Creation of the merged course with all the courses
......@@ -88,14 +88,14 @@ if __name__ == "__main__":
''' classification for all periods '''
classifier.predictionTaskForMergedForAllPeriods(mergedCourse, ntime=10)
#classifier.predictionTaskForMergedForAllPeriods(mergedCourse, ntime=10)
'''
Neural Network : hidden layers
'''
# classifier.scriptClassifier.launchTestForMergedCourseHiddenLayers(mergedCourse)
classifier.scriptClassifier.launchTestForMergedCourseHiddenLayers(mergedCourse)
'''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment