Spaces:
Runtime error
Runtime error
| # import json | |
| # from pathlib import Path | |
| # from lotto_predictor import predict_for_game, NumpyEncoder | |
| # def main(): | |
| # csv_path = Path("pb_results.csv") | |
| # try: | |
| # # Run prediction | |
| # print("Generating prediction...") | |
| # res = predict_for_game(csv_path, "pb", allow_sequences=True, include_wheel=False, wheel_template_path=Path("wheel.txt"), run_backtest=False) | |
| # print("Prediction:") | |
| # print(json.dumps(res, indent=2, cls=NumpyEncoder)) | |
| # except Exception as e: | |
| # print(f"Prediction failed: {str(e)}") | |
| # try: | |
| # # Run backtest | |
| # print("Starting backtest...") | |
| # backtest_res = predict_for_game(csv_path, "pb", allow_sequences=True, include_wheel=False, wheel_template_path=Path("wheel.txt"), run_backtest=True) | |
| # print("Backtest Results:") | |
| # print(json.dumps(backtest_res, indent=2, cls=NumpyEncoder)) | |
| # except Exception as e: | |
| # print(f"Backtest failed: {str(e)}") | |
| # if __name__ == "__main__": | |
| # main() | |
| import json | |
| from pathlib import Path | |
| from lotto_predictor import predict_for_game_v3, NumpyEncoder | |
| def main(): | |
| csv_path = Path("pb_results.csv") | |
| try: | |
| # Run prediction | |
| print("Generating prediction...") | |
| res = predict_for_game_v3(csv_path, "pb", run_backtest=False) | |
| print("Prediction:") | |
| print(json.dumps(res, indent=2, cls=NumpyEncoder)) | |
| print(f"\nPredicted Numbers: {res['numbers']}") | |
| if res.get('star'): | |
| print(f"Star Ball: {res['star']}") | |
| # Print model info | |
| model_info = res.get('model_info', {}) | |
| print(f"\nModel built for {model_info.get('numbers_modeled', 0)} out of {model_info.get('total_possible', 0)} numbers") | |
| except Exception as e: | |
| print(f"Prediction failed: {str(e)}") | |
| import traceback | |
| traceback.print_exc() | |
| # try: | |
| # # Run backtest | |
| # print("\n" + "="*50) | |
| # print("Starting backtest...") | |
| # backtest_res = predict_for_game_v3(csv_path, "pb", run_backtest=True) | |
| # print("\nBacktest Results:") | |
| # print(json.dumps(backtest_res, indent=2, cls=NumpyEncoder)) | |
| # # Print summary | |
| # if 'error' not in backtest_res: | |
| # print(f"\nBacktest Summary:") | |
| # print(f"Model 3+ matches: {backtest_res.get('model_3plus_rate', 0)}%") | |
| # print(f"Random 3+ matches: {backtest_res.get('random_3plus_rate', 0)}%") | |
| # print(f"Average sum error: {backtest_res.get('avg_sum_error', 0)}") | |
| # print(f"Even count accuracy: {backtest_res.get('even_count_accuracy', 0)}%") | |
| # # Show hit rates comparison | |
| # print("\nHit Rate Comparison:") | |
| # for i in range(6): | |
| # model_rate = backtest_res.get(f'model_hit_{i}_rate', 0) | |
| # random_rate = backtest_res.get(f'random_hit_{i}_rate', 0) | |
| # print(f"{i} matches: Model {model_rate}% vs Random {random_rate}%") | |
| # except Exception as e: | |
| # print(f"Backtest failed: {str(e)}") | |
| # import traceback | |
| # traceback.print_exc() | |
| if __name__ == "__main__": | |
| main() |