def test_feature_serialization(self): processed_cycler_run_path = os.path.join(TEST_FILE_DIR, PROCESSED_CYCLER_FILE) predictor = DegradationPredictor.from_processed_cycler_run_file( processed_cycler_run_path, prediction_type='multi', features_label='full_model') # import nose # nose.tools.set_trace() dumpfn( predictor, os.path.join( TEST_FILE_DIR, "2017-12-04_4_65C-69per_6C_CH29_features_predict_only.json")) predictor_reloaded = loadfn( os.path.join( TEST_FILE_DIR, "2017-12-04_4_65C-69per_6C_CH29_features_predict_only.json")) self.assertIsInstance(predictor_reloaded, DegradationPredictor) # test nominal capacity is being generated self.assertEqual(predictor_reloaded.nominal_capacity, 1.0628421000000001) os.remove( os.path.join( TEST_FILE_DIR, "2017-12-04_4_65C-69per_6C_CH29_features_predict_only.json"))
def test_feature_old_class(self): processed_cycler_run_path = os.path.join(TEST_FILE_DIR, PROCESSED_CYCLER_FILE) with ScratchDir('.'): os.environ['BEEP_ROOT'] = os.getcwd() predictor = DegradationPredictor.from_processed_cycler_run_file(processed_cycler_run_path, features_label='full_model') self.assertEqual(predictor.feature_labels[4], "charge_time_cycles_1:5")
def test_feature_generation_full_model(self): processed_cycler_run_path = os.path.join(TEST_FILE_DIR, processed_cycler_file) predictor = DegradationPredictor.from_processed_cycler_run_file( processed_cycler_run_path, features_label='full_model') self.assertEqual(len(predictor.X), 1) # just test if works for now # Ensure no NaN values self.assertFalse(np.any(predictor.X.isnull()))
def test_feature_old_class(self): processed_cycler_run_path = os.path.join(TEST_FILE_DIR, self.processed_cycler_file) with ScratchDir("."): os.environ["BEEP_PROCESSING_DIR"] = os.getcwd() predictor = DegradationPredictor.from_processed_cycler_run_file( processed_cycler_run_path, features_label="full_model") self.assertEqual(predictor.feature_labels[4], "charge_time_cycles_1:5")
def test_feature_serialization_for_training(self): processed_cycler_run_path = os.path.join(TEST_FILE_DIR, processed_cycler_file) predictor = DegradationPredictor.from_processed_cycler_run_file( processed_cycler_run_path, features_label='full_model', predict_only=False) dumpfn( predictor, os.path.join(TEST_FILE_DIR, "2017-12-04_4_65C-69per_6C_CH29_features.json")) predictor_reloaded = loadfn( os.path.join(TEST_FILE_DIR, "2017-12-04_4_65C-69per_6C_CH29_features.json")) self.assertIsInstance(predictor_reloaded, DegradationPredictor)
def test_feature_label_full_model(self): processed_cycler_run_path = os.path.join(TEST_FILE_DIR, processed_cycler_file) predictor = DegradationPredictor.from_processed_cycler_run_file( processed_cycler_run_path, features_label='full_model') self.assertEqual(predictor.feature_labels[4], "charge_time_cycles_1:5")