diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/OpenBaseLab-Edu.iml b/.idea/OpenBaseLab-Edu.iml deleted file mode 100644 index 08fc73f..0000000 --- a/.idea/OpenBaseLab-Edu.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 45d5172..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 29a39d1..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/BaseML/AdaBoost.py b/BaseML/AdaBoost.py index 3e30856..5fcd8ab 100644 --- a/BaseML/AdaBoost.py +++ b/BaseML/AdaBoost.py @@ -19,10 +19,6 @@ def train(self, seed=0, data_type='csv'): np.random.seed(seed) if data_type == 'csv': dataset = pd.read_csv(self.dataset_path, sep=',', header=None).values - elif data_type == 'pandas': - dataset = self.load_pd() - elif data_type == 'list': - dataset = self.load_list() np.random.shuffle(dataset) data, label = dataset[:, :-1], dataset[:, -1] @@ -46,10 +42,3 @@ def inference(self, mode='cls'): def load_dataset(self, path, test_size=0.2): self.dataset_path = path self.test_size = test_size - - def load_pd(self): - pass - - def load_list(self): - pass - diff --git a/BaseML/GaussianNB.py b/BaseML/GaussianNB.py index 403adb7..fad3ae6 100644 --- a/BaseML/GaussianNB.py +++ b/BaseML/GaussianNB.py @@ -20,10 +20,6 @@ def train(self, seed=0, data_type='csv'): np.random.seed(seed) if data_type == 'csv': dataset = pd.read_csv(self.dataset_path, sep=',', header=None).values - elif data_type == 'pandas': - dataset = self.load_pd() - elif data_type == 'list': - dataset = self.load_list() np.random.shuffle(dataset) data, label = dataset[:, :-1], dataset[:, -1] @@ -47,9 +43,3 @@ def inference(self, mode='cls'): def load_dataset(self, path, test_size=0.2): self.dataset_path = path self.test_size = test_size - - def load_pd(self): - pass - - def load_list(self): - pass diff --git a/BaseML/LR.py b/BaseML/LR.py index 21d127c..c028977 100644 --- a/BaseML/LR.py +++ b/BaseML/LR.py @@ -16,11 +16,7 @@ def __init__(self,): def train(self, seed=0, data_type='csv'): np.random.seed(seed) if data_type == 'csv': - dataset = pd.read_csv(self.dataset_path,sep=',',header=None).values - elif data_type == 'pandas': - dataset = self.load_pd() - elif data_type == 'list': - dataset = self.load_list() + dataset = pd.read_csv(self.dataset_path,sep=',',header=None).values np.random.shuffle(dataset) data, label = dataset[:,:-1],dataset[:,-1] @@ -40,9 +36,3 @@ def inference(self, mode='cls'): def load_dataset(self,path,test_size=0.2): self.dataset_path = path self.test_size = test_size - - def load_pd(self): - pass - - def load_list(self): - pass diff --git a/BaseML/SVM.py b/BaseML/SVM.py index 54adc7b..8737a48 100644 --- a/BaseML/SVM.py +++ b/BaseML/SVM.py @@ -19,10 +19,6 @@ def train(self, seed=0, data_type='csv'): np.random.seed(seed) if data_type == 'csv': dataset = pd.read_csv(self.dataset_path, sep=',', header=None).values - elif data_type == 'pandas': - dataset = self.load_pd() - elif data_type == 'list': - dataset = self.load_list() np.random.shuffle(dataset) data, label = dataset[:, :-1], dataset[:, -1] @@ -46,9 +42,3 @@ def inference(self, mode='cls'): def load_dataset(self, path, test_size=0.2): self.dataset_path = path self.test_size = test_size - - def load_pd(self): - pass - - def load_list(self): - pass \ No newline at end of file diff --git a/tools/save_model.py b/tools/save_model.py new file mode 100644 index 0000000..f6e0d20 --- /dev/null +++ b/tools/save_model.py @@ -0,0 +1,15 @@ +import pickle + +def save(self,save_path="latest.pkl"): + print("即将开始保存模型...") + f = open(save_path,"wb") + pickle.dump(self.model,f) + f.close() + print("保存模型 ",save_path," 成功!") + +def load_model(self,load_path="latest.pkl"): + print("即将开始加载模型...") + f = open(load_path,"rb") + self.model = pickle.load(f) + f.close() + print("加载模型 ",load_path," 成功!") \ No newline at end of file