Commit 1d5253c8 authored by ZHOU yao's avatar ZHOU yao
Browse files

Start to run

parent a11a23ae
......@@ -19,10 +19,8 @@ This file is part of Hubble-UserProfile.
@author: Antoine Pigeau
'''
from datetime import datetime
from classifierManager.oulad.scriptAdaBoost import ScriptAdaBoost
from model.oulad.course import Course
......@@ -49,9 +47,12 @@ if __name__ == "__main__":
features = ConstantFeature.FEATURES_ALL
(accuracy, confusionMatrix, resultWeight) = scriptAB.predictionTask(idCourse, groupNames, whereToCut=None)
print("Accuracy:"+str(accuracy))
print("Confusion Matrix:"+str(confusionMatrix))
#scriptAB.predictionTaskForAllCoursesPeriod(groupNames)
scriptAB.predictionTaskForAllCoursesPeriod(groupNames, idCourse)
#scriptABTemporal.predictionTaskForAllCoursesPeriod(groups)
#scriptABTemporalWithStacking.predictionTaskForAllCoursesPeriod(groups)
......
......@@ -38,7 +38,7 @@ class DataManager(DataManagerInterface):
'''
DIRECTORY_DATA = os.path.join(ProjectParameters.DIRECTORY_DATA, ProjectParameters.DIRECTORY_OULAD, 'Dataraw')
print(os.path.abspath('.'))
PATH_STUDENT_VLE = "studentVle.csv"
PATH_STUDENT_INFO = "studentInfo.csv"
PATH_STUDENT_REG = "studentRegistration.csv"
......@@ -131,7 +131,12 @@ class DataManager(DataManagerInterface):
Constant.COLUMN_TYPE_RESOURCE, Constant.COLUMN_DATE,
Constant.COLUMN_WEIGHT]
dateExam = self.courses[self.courses['id_course'] == idCourse]['module_presentation_length'].values[0]
if len(self.courses[self.courses['id_course'] == idCourse]['module_presentation_length']) >0:
dateExam = self.courses[self.courses['id_course'] == idCourse]['module_presentation_length'].values[0]
print(dateExam)
else:
dateExam = 0
assessment.loc[assessment[Constant.COLUMN_TYPE_RESOURCE] == 'Exam', Constant.COLUMN_DATE] = dateExam
course = pd.concat([material, assessment])
......
......@@ -80,7 +80,10 @@ class Constant:
# FEATURE_MAX_AMPLITUDE = 49
FEATURES_ALL = [FEATURE_ALL_MARKS, FEATURE_WINDOW_DURATION]#list(range(0,50))
FEATURES_ALL = [FEATURE_WINDOW_DURATION, FEATURE_DURATION_BEFORE_ASSESSMENT,
FEATURE_NBR_EVENT_BEFORE_ASSESSMENT,FEATURE_NBR_SESSION_BEFORE_ASSESSMENT,
FEATURE_SUM_FIRST_WEEK, FEATURE_DAY_BEFORE_DEADLINE,FEATURE_MAX_REST_DAY,
FEATURE_DURATION_REST, FEATURE_AVERAGE_REST_DAY]
FEATURES_NAMES = ['total intensity', 'window duration', 'linearity', 'inter median', 'nbr access per part', 'duration per part',
'average duration per part', 'all marks', 'duration before assessment', 'nbr event before assessment', 'nbr session before assessment',
......
......@@ -121,6 +121,8 @@ class FeatureGroup:
data = self.group.getData()
groups = data.groupby(ConstantModel.COLUMN_ID_USER)
dataFeature = None
for idUser, group in groups:
......
......@@ -85,6 +85,7 @@ class FeatureMultiGroup:
- add the featureGroup
'''
featureGroup = FeatureGroup(group)
featureGroup.load(features)
......@@ -107,7 +108,8 @@ class FeatureMultiGroup:
for groupName in names:
group = Group(course, groupName, whereToCut=whereToCut, WhereToCutUnity=whereToCutUnity)
self.__addGroup(group, features)
if len(group.getData()) > 0:
self.__addGroup(group, features)
def getNumberOfUsers(self):
......
......@@ -28,7 +28,7 @@ class Course:
'''
@staticmethod
def getCourseName(idCourse):
def getCourseName(idCourse,summary=True):
'''
function that return a textual representation of the course
......@@ -38,7 +38,7 @@ class Course:
@return: string, the name of the course
'''
raise NotImplementedError
return str(idCourse)
def __init__(self, idCourse):
'''
......
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