def main (): start_time = datetime.datetime.now() print('Tiempo inicial', start_time) #Iniciar Spark sc = init_spark() spark = SparkSession(sc) # Conexion a sqlite c = init_sqlite() # Generar una lista con todos los generos y asignarle un numero a cada uno genres = load_genres(c) # Cargar la data a un dataframe data, headers_feature = load_dataset(c, spark, genres) # Correr la clasificacion por regresion logistica regression.run(data, headers_feature) # Correr la clasificacion por redes neuronales neural.run(data, headers_feature) end_time = datetime.datetime.now() print('Tiempo final', end_time) print('Tiempo total transcurrido', end_time - start_time)
def predict(): neighborhood = request.args.get('neighborhood') layout = request.args.get('layout') bathrooms = request.args.get('bathrooms') square_footage = request.args.get('square_footage') predicted_price = regression.run([{ 'neighborhood': neighborhood, 'layout': layout, 'bathrooms': bathrooms, 'square_footage': int(square_footage) }]) return jsonify(predicted_price[0][0])
epochs = args.epochs, criterion = criterion, batch_size=args.batch_size, subspace_type=args.subspace, subspace_kwargs={'max_rank':args.max_num_models}, momentum = args.momentum, wd=args.wd, lr_init=args.lr_init, swag_lr = args.swag_lr, swag_freq = 1, swag_start = args.swag_start, use_cuda = torch.cuda.is_available(), use_swag = args.swag, scale=args.scale, num_samples=args.num_samples, const_lr=args.no_schedule, double_bias_lr=False, model_variance=args.model_variance, **extra_args, input_dim=dataset.D, output_dim=output_dim, apply_var=args.noise_var, **model_cfg.kwargs ) mname = args.model if args.swag: mname = mname + args.subspace + args.inference bb_args = argparse.Namespace(model=mname, dataset=args.dataset, split=args.split, seed=args.seed, database_path=args.database_path) bb_result = run(bb_args, data=dataset, model=regression_model, is_test=args.database_path=='') print(bb_result) utils.save_checkpoint( args.dir, args.epochs, model_state_dict=regression_model.model.state_dict(), optimizer=regression_model.optimizer.state_dict(), result=bb_result )
}) result = self.execute_command( self.BASE_COMMAND + "ninjadroid /apks/Example.apk --all --json") # NOTE: the below hack is needed to remove the SHA1withRSA signature algorithm warning... result = "\n".join(result.split('\n')[4:]) self.assert_json_equal(expected, result) @RegressionSuite.test def extract_extended(self): expected = self.read_plain_text_file( "regression/expected/extract.txt", overrides={ 18: "7ab36f88adf38f96df05c9e024d548ab output/report-Example.json" }) self.execute_command( self.BASE_COMMAND_WITH_OUTPUT + "ninjadroid /apks/Example.apk --all --extract /output") # NOTE: the .jar file checksum changes at every run... result = self.execute_command( "find output/ -type f -exec md5sum '{}' + | grep -v Example.jar") self.assert_plain_text_equal(expected, result) if __name__ == "__main__": run(suite=DockerRegressionSuite())
result = self.execute_command( "ninjadroid regression/data/Example.apk --json") self.assert_json_equal(expected, result) @RegressionSuite.test def show_json_extended(self): expected = self.read_json_file("regression/expected/extended.json") result = self.execute_command( "ninjadroid regression/data/Example.apk --all --json") self.assert_json_equal(expected, result) @RegressionSuite.test def extract_extended(self): expected = self.read_plain_text_file("regression/expected/extract.txt") self.execute_command( "ninjadroid regression/data/Example.apk --all --extract output/") # NOTE: the .jar file checksum changes at every run... result = self.execute_command( "find output/ -type f -exec md5sum '{}' + | grep -v Example.jar") self.assert_plain_text_equal(expected, result) if __name__ == "__main__": run(suite=NativeRegressionSuite())
self.assert_plain_text_equal(expected, result, multiline=False) @RegressionSuite.test def show_extended(self): expected = self.read_plain_text_file("regression/expected/extended.txt") result = self.execute_command(self.BASE_COMMAND + "ninjadroid regression/data/Example.apk --all") self.assert_plain_text_equal(expected, result, multiline=False) @RegressionSuite.test def show_json_summary(self): expected = self.read_json_file("regression/expected/summary.json") result = self.execute_command(self.BASE_COMMAND + "ninjadroid regression/data/Example.apk --json") self.assert_json_equal(expected, result) @RegressionSuite.test def show_json_extended(self): expected = self.read_json_file("regression/expected/extended.json") result = self.execute_command(self.BASE_COMMAND + "ninjadroid regression/data/Example.apk --all --json") self.assert_json_equal(expected, result) if __name__ == "__main__": run(suite = FlatpakRegressionSuite())
}, }) result = self.execute_command( self.BASE_PATH + "ninjadroid regression/data/Example.apk --all --json") self.assert_json_equal(expected, result) @RegressionSuite.test def extract_extended(self): expected = self.read_plain_text_file( "regression/expected/extract.txt", overrides={ 18: "25ada2132e42197adfaccd8293c8363a output/report-Example.json" }) self.execute_command( self.BASE_PATH + "ninjadroid regression/data/Example.apk --all --extract output/") # NOTE: the .jar file checksum changes at every run... result = self.execute_command( "find output/ -type f -exec md5sum '{}' + | grep -v Example.jar") self.assert_plain_text_equal(expected, result) if __name__ == "__main__": run(suite=SnapRegressionSuite())
cfb.PassIntOff.describe() # How many interceptions this team has thrown cfb.FumblesOff.describe() # How many fumbles this team has had cfb.Opponent.describe() # Opponent's name cfb.ScoreDef.describe() # Opponent's total score cfb.RushAttDef.describe() # Opponent's rush attempts cfb.RushYdsDef.describe() # Opponent's rush yards cfb.PassAttDef.describe() # Opponent's passing attempts cfb.PassCompDef.describe() # Opponent's passing completions cfb.PassYdsDef.describe() # Opponent's total passing yards cfb.PassIntDef.describe() # How many interceptions the opponent has thrown cfb.FumblesDef.describe() # How many fumbles the opponent has had cfb.Site.describe() # Whether the game was home, away, or at a neutral site cfb.Line.describe() # Vegas betting line; Human prediction of score cfb.ScoreOffCat.describe() # This teams score broken into categories cfb.ScoreDefCat.describe() # Opposing team's score broken into categories # 5 # Visuals visuals.run() # 6 # Machine learning regression.run() predictwin.run()
def run_regression(): reload(reg) reg.training_file_name = './data/regression_data.txt' reg.groundtruth_file_name = './data/regression_groundtruth.txt' reg.run()