Giter VIP home page Giter VIP logo

predict_lottery_ticket's Introduction

彩票理论上属于完全随机事件,任何一种单一算法,都不可能精确的预测彩票结果!!

请合理投资博彩行业,切勿成迷!!


彩票AI预测(目前支持双色球,大乐透,排列三,快乐8, 七星彩,福彩3D)


一定要用get_data下载数据,并用train一定次数后,才能使用predict预测,默认没有数据和模型

如果train发生错误,请优先检查主目录下是否有data, model, predict三个空目录,没有的话自行建立下,我好像忘记让它自动生成了,也懒得写了

现有的模型对于七星彩,福彩3D,排列三等允许重复数字的彩票,效果可能有不好,因为我只是简单的把数字当成了类别,没有更多的考虑到数字之间的关系,而且由于时间原因,我也没有详细测试,所以,如果想要更加准确的预测这些彩票,可以自己修改代码,或者将建议留下,等我有空了再更新


有些朋友发消息问我最近(2023.12.03)发生的快8选7中50000倍的可能性,这么说,这个事其实也跟其他朋友问我为啥最近开始研究统计学的应用是同一个原因,因为我早几个月也发现了,纯粹的某些特定的统计学算法,就可以使得快8选7的平均返奖率维持在60%左右,如果再运用热力图,分布律等特殊的策略,还能使得返奖率在一定范围内维持更高。我当时使用这个方法,也获得了一定的收益。当然这个方法是高投入型的,需要长期稳定的高投入,所以不是我想要的算法,也就没有在这里推荐,而是打算作为神经网络的数据预处理算法来用


至于这次事情的单注50000倍玩法,不管你信不信,我是不信的。

项目思路来自自 zepen 大佬的作品 已将80%的代码重写,并按照我自己的思路进行了强化和修改。 自动选择并同时支持CPU和GPU计算。CPU使用原本的Keras LSTM,GPU使用CudnnLSTM,同等参数下,GPU效率高于CPU,时间窗口越大,batch_size越大,效率差就越明显;建议有好显卡的朋友使用GPU训练. 目前我正在修改网络结构,并迁移到我比较熟悉的pytorch框架之下。

New

  • 20231031
    1. 增加了kl8 plus系列文件,修改了kl8_running, 使其都使用多线程处理数据,加快数据处理速度,正常情况无需使用;特殊需要使用的用户要注意自己cpu的核心数,默认会产生cal_nums_list数量 * total_create_list数量 * nums_range数量个进程, 性能不足,核少的cpu会被卡死,请谨慎使用
  • 20230903
    1. 增加了两个kl8_开头的文件,用来测试计算一些数据预处理的公式,以及计算预测号码获奖情况, 正常情况无需使用
  • 20230327
    1. 增加对于七星彩(qxc),福彩3D(sd)的支持
  • 20230322:
    1. 增加执行参数开关,针对red_epochs,blue_epochs,batch_size三个参数,如果值为-1,则读取config文件的值,且修改三个参数的默认值为-1

Installing

  • step1,安装anaconda

  • step2,创建一个conda环境,conda create -n your_env_name python=3.8;

  • step3,进入创建conda的环境 conda activate your_env_name,然后根据自己机器的状况,选择CPU或者GPU模式,并在requirement文件中,把对应版本的Tensorflow解除注释,并执行pip install -r requirements.txt;如果不确定哪个版本更合适,建议使用gpu版本

  • 备注:根据我个人的测试,不推荐使用其他版本的tensorflow,如果因为硬件原因,一定要用更高或者更低版本的tensorflow,请同时更新tensorflow-addons,pandas,numpy的版本。

  • step4,按照Getting Started执行即可

Getting Started

python get_data.py  --name ssq  # 执行获取双色球训练数据

如果出现解析错误,应该看看500网网页是否可以正常访问 若要大乐透,替换参数 --name dlt 即可

python run_train_model.py --name ssq  --windows_size 3,5,7 --red_epochs 1 --blue_epochs 1 --batch_size 1  # 执行训练双色球模型

开始模型训练,先训练红球模型,再训练蓝球模型,模型参数和超参数在 config.py 文件中自行配置 具体训练时间消耗与模型参数和超参数相关。 若要多个窗口尺寸依次训练,替换参数 --windows_size 3,5,7 即可 red_epochs 为红球训练次数 blue_epochs 为篮球训练次数 batch_size 为每轮训练的数量

python run_predict.py  --name ssq --windows_size 3,5,7  # 执行双色球模型预测

预测结果会打印在控制台

注意事项:

  1. 使用高于1个batch_size训练后,不能立即预测,必须使用1个batch_size再次训练保存才可以,应该是batch_size维度被保存在inputs里面的原因,也可使用--predict_pro 1 参数进行这个动作
  2. 使用GPU推导时使用的是RNN的CudnnLSTM而非Keras的LSTM,因此两个模型保存的checkpoint不通用!

predict_lottery_ticket's People

Contributors

kittencn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

predict_lottery_ticket's Issues

快乐8提升中奖率建议

kl8_anylysis

  1. 选10中奖率太低,建议改成中奖率最高的选4、选5,如果追求稍微高点的奖金可以选7
  2. matplotlib 聚类图和原项目numpy版本冲突,建议删除这个代码即可
  3. 选号方法,只要热号(近10-20期出现较多的号码)、跳号、邻号、斜连号等
    不知是否可以建立个qq群以便更好的讨论细节

博主,你好,根据安装提示并未安装tensorflow,这是什么问题?

OS:win7_x64
python : 3.8.17

snipaste20230803_170351

snipaste20230803_160807

(py38) D:\Lottery\predict_Lottery_ticket-main>
(py38) D:\Lottery\predict_Lottery_ticket-main>python get_data.py --name ssq
Traceback (most recent call last):
File "get_data.py", line 7, in
from common import get_data_run
File "D:\Lottery\predict_Lottery_ticket-main\common.py", line 13, in
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

(py38) D:\Lottery\predict_Lottery_ticket-main>pip3 show tensorflow
WARNING: Package(s) not found: tensorflow

报错

Traceback (most recent call last):
File "E:\predict_Lottery_ticket-main\run_predict.py", line 52, in
_data, title = predict_run(args.name)
File "E:\predict_Lottery_ticket-main\common.py", line 422, in predict_run
predict_features
= try_error(name, data, windows_size)
File "E:\predict_Lottery_ticket-main\common.py", line 320, in try_error
if len(predict_features) != windows_size:
TypeError: object of type 'NoneType' has no len()Traceback (most recent call last):
File "E:\predict_Lottery_ticket-main\run_predict.py", line 52, in
_data, title = predict_run(args.name)
File "E:\predict_Lottery_ticket-main\common.py", line 422, in predict_run
predict_features
= try_error(name, data, windows_size)
File "E:\predict_Lottery_ticket-main\common.py", line 320, in try_error
if len(predict_features) != windows_size:
TypeError: object of type 'NoneType' has no len()

运行出错而且快乐八没有预测结果

File "C:\Users\71539\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\training\saver.py", line 1599, in _import_meta_graph_with_return_elements
meta_graph_def = meta_graph.read_meta_graph_file(meta_graph_or_file)
File "C:\Users\71539\AppData\Roaming\Python\Python310\site-packages\tensorflow\python\framework\meta_graph.py", line 611, in read_meta_graph_file
raise IOError(f"File does not exist. Received: {filename}.")
OSError: File does not exist. Received: T:\全系列彩票预测\predict_Lottery_ticket-main\predict_Lottery_ticket-main/model//ssq/3/red_ball_model/red_ball_model.ckpt.meta.
(base) PS T:\全系列彩票预测\predict_Lottery_ticket-main\predict_Lottery_ticket-main> python run_predict.py --name ssq kl8
2024-04-05 22:27:23.339476: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
WARNING:tensorflow:From C:\Users\71539\AppData\Roaming\Python\Python310\site-packages\keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

WARNING:tensorflow:From T:\全系列彩票预测\predict_Lottery_ticket-main\predict_Lottery_ticket-main\common.py:219: The name tf.disable_eager_execution is deprecated. Please use tf.compat.v1.disable_eager_execution instead.

2024-04-05 22:27:28.448749: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE SSE2 SSE3 SSE4.1 SSE4.2 AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
usage: run_predict.py [-h] [--name NAME] [--windows_size WINDOWS_SIZE] [--cq CQ]
run_predict.py: error: unrecognized arguments: kl8
(base) PS T:\全系列彩票预测\predict_Lottery_ticket-main\predict_Lottery_ticket-main>

请问ssq在训练过程中出现的一些报错信息

具体报错信息如下,较多,烦请大佬看看是什么原因导致的:
2023-11-21 11:56:07.314324: W tensorflow/c/c_api.cc:304] Operation '{name:'embedding/embeddings/Assign' id:17 op device:{requested: '', assigned: ''} def:{{{node embedding/embeddings/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](embedding/embeddings, embedding/embeddings/Initializer/stateless_random_uniform)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.317735: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice/stack_1' id:23 op device:{requested: '', assigned: ''} def:{{{node strided_slice/stack_1}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 0 0 1...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.318914: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice/stack_2' id:24 op device:{requested: '', assigned: ''} def:{{{node strided_slice/stack_2}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 1 1 1...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.373457: W tensorflow/c/c_api.cc:304] Operation '{name:'lstm/lstm_cell/bias/Assign' id:75 op device:{requested: '', assigned: ''} def:{{{node lstm/lstm_cell/bias/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](lstm/lstm_cell/bias, lstm/lstm_cell/bias/Initializer/concat)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.386801: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_1/stack_1' id:287 op device:{requested: '', assigned: ''} def:{{{node strided_slice_1/stack_1}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 0 0 2...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.394237: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_1/stack_2' id:288 op device:{requested: '', assigned: ''} def:{{{node strided_slice_1/stack_2}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 1 1 1...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.461841: W tensorflow/c/c_api.cc:304] Operation '{name:'lstm_1/lstm_cell/kernel/Assign' id:309 op device:{requested: '', assigned: ''} def:{{{node lstm_1/lstm_cell/kernel/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](lstm_1/lstm_cell/kernel, lstm_1/lstm_cell/kernel/Initializer/stateless_random_uniform)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.481893: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_2/stack_1' id:553 op device:{requested: '', assigned: ''} def:{{{node strided_slice_2/stack_1}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 0 0 3...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.495515: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_2/stack_2' id:554 op device:{requested: '', assigned: ''} def:{{{node strided_slice_2/stack_2}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 1 1 1...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.577133: W tensorflow/c/c_api.cc:304] Operation '{name:'lstm_2/lstm_cell/recurrent_kernel/Assign' id:598 op device:{requested: '', assigned: ''} def:{{{node lstm_2/lstm_cell/recurrent_kernel/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](lstm_2/lstm_cell/recurrent_kernel, lstm_2/lstm_cell/recurrent_kernel/Initializer/mul_1)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.604845: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_3/stack_1' id:819 op device:{requested: '', assigned: ''} def:{{{node strided_slice_3/stack_1}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 0 0 4...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.625097: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_3/stack_2' id:820 op device:{requested: '', assigned: ''} def:{{{node strided_slice_3/stack_2}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 1 1 1...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.718605: W tensorflow/c/c_api.cc:304] Operation '{name:'lstm_3/lstm_cell/bias/Assign' id:873 op device:{requested: '', assigned: ''} def:{{{node lstm_3/lstm_cell/bias/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](lstm_3/lstm_cell/bias, lstm_3/lstm_cell/bias/Initializer/concat)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.754472: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_4/stack_1' id:1085 op device:{requested: '', assigned: ''} def:{{{node strided_slice_4/stack_1}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 0 0 5...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.781493: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_4/stack_2' id:1086 op device:{requested: '', assigned: ''} def:{{{node strided_slice_4/stack_2}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 1 1 1...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.890400: W tensorflow/c/c_api.cc:304] Operation '{name:'lstm_4/lstm_cell/kernel/Assign' id:1107 op device:{requested: '', assigned: ''} def:{{{node lstm_4/lstm_cell/kernel/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](lstm_4/lstm_cell/kernel, lstm_4/lstm_cell/kernel/Initializer/stateless_random_uniform)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.935544: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_5/stack_1' id:1351 op device:{requested: '', assigned: ''} def:{{{node strided_slice_5/stack_1}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 0 0 6...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:07.967973: W tensorflow/c/c_api.cc:304] Operation '{name:'strided_slice_5/stack_2' id:1352 op device:{requested: '', assigned: ''} def:{{{node strided_slice_5/stack_2}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [4] values: 1 1 1...>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.085564: W tensorflow/c/c_api.cc:304] Operation '{name:'lstm_5/lstm_cell/bias/Assign' id:1405 op device:{requested: '', assigned: ''} def:{{{node lstm_5/lstm_cell/bias/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](lstm_5/lstm_cell/bias, lstm_5/lstm_cell/bias/Initializer/concat)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.390042: W tensorflow/c/c_api.cc:304] Operation '{name:'dense/kernel/Assign' id:1886 op device:{requested: '', assigned: ''} def:{{{node dense/kernel/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](dense/kernel, dense/kernel/Initializer/stateless_random_uniform)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.481486: W tensorflow/c/c_api.cc:304] Operation '{name:'Slice_2/size' id:2228 op device:{requested: '', assigned: ''} def:{{{node Slice_2/size}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [3] values: -1 -1 -1>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.586300: W tensorflow/c/c_api.cc:304] Operation '{name:'Slice_1/begin' id:2223 op device:{requested: '', assigned: ''} def:{{{node Slice_1/begin}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [3] values: 0 0 0>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.663866: W tensorflow/c/c_api.cc:304] Operation '{name:'Slice_1/size' id:2224 op device:{requested: '', assigned: ''} def:{{{node Slice_1/size}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [3] values: -1 1 -1>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.741485: W tensorflow/c/c_api.cc:304] Operation '{name:'SequenceMask/Range' id:2241 op device:{requested: '', assigned: ''} def:{{{node SequenceMask/Range}} = Range[Tidx=DT_INT32, _has_manual_control_dependencies=true](SequenceMask/Const, strided_slice_8, SequenceMask/Const_1)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.818814: W tensorflow/c/c_api.cc:304] Operation '{name:'SequenceMask/ExpandDims/dim' id:2242 op device:{requested: '', assigned: ''} def:{{{node SequenceMask/ExpandDims/dim}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [] values: -1>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.894904: W tensorflow/c/c_api.cc:304] Operation '{name:'Const_1' id:2230 op device:{requested: '', assigned: ''} def:{{{node Const_1}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [] values: 0>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:08.972938: W tensorflow/c/c_api.cc:304] Operation '{name:'sub_1/y' id:2231 op device:{requested: '', assigned: ''} def:{{{node sub_1/y}} = Const_has_manual_control_dependencies=true, dtype=DT_INT32, value=Tensor<type: int32 shape: [] values: 1>}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
2023-11-21 11:56:09.630670: W tensorflow/c/c_api.cc:304] Operation '{name:'Variable/Assign' id:1913 op device:{requested: '', assigned: ''} def:{{{node Variable/Assign}} = AssignVariableOp[_has_manual_control_dependencies=true, dtype=DT_FLOAT, validate_shape=false](Variable, stateless_random_uniform)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.

BatchSize大于1无法预测

现在训练中遇到的问题:

  1. 当设置BatchSize大于1后无法预测,需要设置BatchSize为1重新训练,想问问各位大佬这样重新训练后对模型的预测结果是否会有影响
  2. 当设置BatchSize大于1,比如512,1024后,多次训练会导致loss值为Nan的错误。
    望哪位大佬帮忙解答下。

大佬好,在run_train_model.py时遇到问题啦?help !

This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE SSE2 SSE3 SSE4.1 SSE4.2 AVX AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File "D:\Files\python object\predict_Lottery_ticket-main2\run_train_model.py", line 17, in
from modeling import LstmWithCRFModel, SignalLstmModel, tf
File "D:\Files\python object\predict_Lottery_ticket-main2\modeling.py", line 8, in
from tensorflow_addons.text.crf import crf_decode, crf_log_likelihood
ModuleNotFoundError: No module named 'tensorflow_addons'

请问KL8_ANALYSIS和LSTM模型

KL8_ANALYSIS和LSTM模型应该不是一回事吧?一个是自主寻找数字规律并随即生成符合规律的数,另一个是让模型自己找规律。看到大佬最近都在更新KL8_ANALYSIS,难道说是模型无法发现诸如奇偶性、冷热号这些规律吗?

启动七星彩训练如何调参报错了求指点

正在创建【七星彩】数据集...
2023-06-01 13:58:48.902 | INFO | common:get_data_run:23 - 【七星彩】最新一期期号:23061
2023-06-01 13:58:48.903 | INFO | common:get_data_run:24 - 正在获取【七星彩】数据。。。
2023-06-01 13:58:49.603 | INFO | common:get_data_run:32 - 【七星彩】数据准备就绪,共2892期, 下一步可训练模型...
2023-06-01 13:58:49.605 | INFO | main:action:359 - 正在创建【七星彩】数据集...
2023-06-01 13:58:49.609 | INFO | main:create_train_data:65 - 训练数据已加载!
2023-06-01 13:58:49.610 | INFO | main:create_train_data:68 - 训练集数据维度: (2892, 7)
2023-06-01 13:58:49.614 | INFO | main:action:364 - 开始训练【七星彩】红球模型...
2023-06-01 13:58:49.615 | INFO | main:train_red_ball_model:99 - 特征数据维度: (2888, 3, 7)
2023-06-01 13:58:49.615 | INFO | main:train_red_ball_model:100 - 标签数据维度: (2888, 7)
2023-06-01 13:58:49.637597: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:354] MLIR V1 optimization pass is not enabled
2023-06-01 13:58:52.521392: W tensorflow/core/common_runtime/forward_type_inference.cc:332] Type inference failed. This indicates an invalid graph that escaped type checking. Error message: INVALID_ARGUMENT: expected compatible input types, but input 1:
type_id: TFT_OPTIONAL
args {
type_id: TFT_PRODUCT
args {
type_id: TFT_TENSOR
args {
type_id: TFT_INT32
}
}
}
is neither a subtype nor a supertype of the combined inputs preceding it:
type_id: TFT_OPTIONAL
args {
type_id: TFT_PRODUCT
args {
type_id: TFT_TENSOR
args {
type_id: TFT_FLOAT
}
}
}

    while inferring type of node 'cond_1/output/_1862'

2023-06-01 13:58:55.961582: W tensorflow/c/c_api.cc:349] Operation '{name:'lstm_6/while' id:1828 op device:{requested: '', assigned: ''} def:{{{node lstm_6/while}} = While[T=[DT_INT32, DT_INT32, DT_INT32, DT_VARIANT, DT_FLOAT, 13037780287242672343, DT_VARIANT, DT_VARIANT, DT_VARIANT, DT_VARIANT, DT_VARIANT], _lower_using_switch_merge=true, _num_original_outputs=45, _read_only_resource_inputs=[8, 9, 10], _stateful_parallelism=false, body=lstm_6_while_body_2931[], cond=lstm_6_while_cond_2930[], output_shapes=[[], [], [], [], [1,10], 8875109386904515972, [], [], [], [], []], parallel_iterations=32](lstm_6/while/loop_counter, lstm_6/while/maximum_iterations, lstm_6/time, lstm_6/TensorArrayV2_1, lstm_6/zeros, lstm_6/zeros_1, lstm_6/strided_slice_1, lstm_6/TensorArrayUnstack/TensorListFromTensor, lstm_6/lstm_cell_6/kernel, lstm_6/lstm_cell_6/recurrent_kernel, lstm_6/lstm_cell_6/bias, lstm_6/while/EmptyTensorList, lstm_6/while/EmptyTensorList_1, lstm_6/while/EmptyTensorList_2, lstm_6/while/EmptyTensorList_3, lstm_6/while/EmptyTensorList_4, lstm_6/while/EmptyTensorList_5, lstm_6/while/EmptyTensorList_6, lstm_6/while/EmptyTensorList_7, lstm_6/while/EmptyTensorList_8, lstm_6/while/EmptyTensorList_9, lstm_6/while/EmptyTensorList_10, lstm_6/while/EmptyTensorList_11, lstm_6/while/EmptyTensorList_12, lstm_6/while/EmptyTensorList_13, lstm_6/while/EmptyTensorList_14, lstm_6/while/EmptyTensorList_15, lstm_6/while/EmptyTensorList_16, lstm_6/while/EmptyTensorList_17, lstm_6/while/EmptyTensorList_18, lstm_6/while/EmptyTensorList_19, lstm_6/while/EmptyTensorList_20, lstm_6/while/EmptyTensorList_21, lstm_6/while/EmptyTensorList_22, lstm_6/while/EmptyTensorList_23, lstm_6/while/EmptyTensorList_24, lstm_6/while/EmptyTensorList_25, lstm_6/while/EmptyTensorList_26, lstm_6/while/EmptyTensorList_27, lstm_6/while/EmptyTensorList_28, lstm_6/while/EmptyTensorList_29, lstm_6/while/EmptyTensorList_30, lstm_6/while/EmptyTensorList_31, lstm_6/while/EmptyTensorList_32, lstm_6/while/EmptyTensorList_33)}}' was changed by setting attribute after it was run by a session. This mutation will have no effect, and will trigger an error in the future. Either don't modify nodes after running them or create a new session.
Traceback (most recent call last):
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 1378, in _do_call
return fn(*args)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 1361, in _run_fn
return self._call_tf_sessionrun(options, feed_dict, fetch_list,
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 1454, in _call_tf_sessionrun
return tf_session.TF_SessionRun_wrapper(self._session, options, feed_dict,
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,0,6] = 13 is not in [0, 10)
[[{{node embedding/embedding_lookup}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "run_train_model.py", line 515, in
run(args.name, list_windows_size)
File "run_train_model.py", line 392, in run
action(name)
File "run_train_model.py", line 366, in action
train_red_ball_model(name, x_data=train_data["red"]["x_data"], y_data=train_data["red"]["y_data"])
File "run_train_model.py", line 160, in train_red_ball_model
, loss, pred = sess.run([
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 968, in run
result = self._run(None, fetches, feed_dict, options_ptr,
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 1191, in _run
results = self._do_run(handle, final_targets, final_fetches,
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 1371, in _do_run
return self._do_call(_run_fn, feeds, fetches, targets, options,
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 1397, in _do_call
raise type(e)(node_def, op, message) # pylint: disable=no-value-for-parameter
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node 'embedding/embedding_lookup' defined at (most recent call last):
File "run_train_model.py", line 515, in
run(args.name, list_windows_size)
File "run_train_model.py", line 392, in run
action(name)
File "run_train_model.py", line 366, in action
train_red_ball_model(name, x_data=train_data["red"]["x_data"], y_data=train_data["red"]["y_data"])
File "run_train_model.py", line 102, in train_red_ball_model
red_ball_model = LstmWithCRFModel(
File "C:\Users\eru1030\Desktop\predict_Lottery_ticket-main\modeling.py", line 38, in init
embedding = tf.keras.layers.Embedding(words_size, embedding_size)(self._inputs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\keras\engine\base_layer_v1.py", line 838, in call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\keras\layers\core\embedding.py", line 208, in call
out = tf.nn.embedding_lookup(self.embeddings, inputs)
Node: 'embedding/embedding_lookup'
indices[0,0,6] = 13 is not in [0, 10)
[[{{node embedding/embedding_lookup}}]]

Original stack trace for 'embedding/embedding_lookup':
File "run_train_model.py", line 515, in
run(args.name, list_windows_size)
File "run_train_model.py", line 392, in run
action(name)
File "run_train_model.py", line 366, in action
train_red_ball_model(name, x_data=train_data["red"]["x_data"], y_data=train_data["red"]["y_data"])
File "run_train_model.py", line 102, in train_red_ball_model
red_ball_model = LstmWithCRFModel(
File "C:\Users\eru1030\Desktop\predict_Lottery_ticket-main\modeling.py", line 38, in init
embedding = tf.keras.layers.Embedding(words_size, embedding_size)(self._inputs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\keras\engine\base_layer_v1.py", line 838, in call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\keras\layers\core\embedding.py", line 208, in call
out = tf.nn.embedding_lookup(self.embeddings, inputs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\traceback_utils.py", line 150, in error_handler
return fn(*args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\dispatch.py", line 1176, in op_dispatch_handler
return dispatch_target(*args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\ops\embedding_ops.py", line 402, in embedding_lookup_v2
return embedding_lookup(params, ids, "div", name, max_norm=max_norm)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\traceback_utils.py", line 150, in error_handler
return fn(*args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\dispatch.py", line 1176, in op_dispatch_handler
return dispatch_target(*args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\ops\embedding_ops.py", line 330, in embedding_lookup
return _embedding_lookup_and_transform(
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\ops\embedding_ops.py", line 144, in _embedding_lookup_and_transform
array_ops.gather(params[0], ids, name=name), ids, max_norm)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\traceback_utils.py", line 150, in error_handler
return fn(*args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\dispatch.py", line 1176, in op_dispatch_handler
return dispatch_target(*args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\util\deprecation.py", line 561, in new_func
return func(*args, **kwargs)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\ops\array_ops.py", line 5284, in gather
return params.sparse_read(indices, name=name)
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\ops\resource_variable_ops.py", line 750, in sparse_read
value = gen_resource_variable_ops.resource_gather(
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\ops\gen_resource_variable_ops.py", line 620, in resource_gather
_, _, _op, _outputs = _op_def_library._apply_op_helper(
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\framework\op_def_library.py", line 797, in _apply_op_helper
op = g._create_op_internal(op_type_name, inputs, dtypes=None,
File "C:\Users\eru1030\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\framework\ops.py", line 3800, in _create_op_internal
ret = Operation(

大佬不知道最近有没有对LSTM进行继续研究呢?我训练几十遍模型,发现选4在某些时候可以达到盈利。

但是预测的总体正确个数却没有比期望高太多,选4期望是中1个,我将最近的100期作为测试集,预测正确的个数差不多109个,略高于期望,但好几次限模拟能实现盈利,因为有时候一期预测中4个就是100,即使后面3期连续不中也是赚的。
想请问大佬那些盈利的训练是否可以表示模型训练较为成功,可以保存其权重、参数等数据作为日后预测用?

关于modeling.py,help!

from tensorflow.compat.v1.keras.layers import CuDNNLSTM as LSTM compat标红了
from tensorflow.keras.layers import LSTM keras标红了

请问kl8的训练和预测命令

如题,抱歉我是小白不太懂
python run_train_model.py --name kl8
python run_predict.py --name kl8
是不是这样就可以了

还有就是我训练了两次,预测号码会有些许不同。请问这个训练是会迭代的还是每次训练都是从头开始的呀

请问KL8_ANALYSIS的预测包含最近一期吗?

我运行analysis和cash的时候提示是以最新一期公布号码的快乐8来预测,比如今天是263期,已经公布号码了,那么请问在统计数学统计量的时候263期本身有没有算进去?如果算进去的话会不会影响各种统计量?
刚才试了下,感觉比LSTM训练的还准一些......

安装过程有一点小问题

先说一下安装过程, protobuf版本会报错, 限定在3.20就好了, 还有一个numpy的版本改为1.18.5, 就不会报错, 还少一个Pillow组件.
其他没问题, 程序写的很好, 运行也没问题.
希望作者可以加入7乐彩的彩种, 那个没有重复号码也没有篮球, 相对来说概率会提高不少.
另外不知道作者研究过马尔可夫链, 之前看有马尔可夫链预测彩票的相关论文, 效果据说不错.

本模型训练结果是否缺少了保存训练成果的步骤?

因为用较大的batch_size训练后无法直接预测,需要用batch_size=1再训练一次后才能预测,经过很多次我才发现,无论用较大的batch_size加上4000~5000的epochs训练到loss值有多低,因为不能预测而必须再用batch_size=1再训练一次时会发现loss值又变得很高,也就是说没有保存和继承之前的训练结果,还请作者不厌其烦给予指点,如果保存训练结果并在下次训练时继承之前的成果

RuntimeError: permute(sparse_coo):

大佬,运行不起来。错误日志:
D:\study\ml\predict_Lottery_ticket_pytorch-master>python run_train_model.py --name ssq --windows_size 3,5,7 --red_epochs 1 --blue_epochs 1 --batch_size 1
2023-05-17 10:40:51.928 | INFO | main::135 - 正在创建【双色球】数据集...
2023-05-17 10:40:51.929 | INFO | main:action:95 - 正在创建【双色球】数据集...
2023-05-17 10:40:51.936 | INFO | common:create_train_data:41 - 训练数据已加载!
2023-05-17 10:40:51.952 | INFO | common:create_train_data:72 - 训练集数据维度: (2996, 4, 6, 1)
2023-05-17 10:40:51.955 | INFO | common:create_train_data:41 - 训练数据已加载!
2023-05-17 10:40:52.012 | INFO | common:create_train_data:72 - 训练集数据维度: (2996, 4, 6, 1)
2023-05-17 10:40:52.017 | INFO | main:action:100 - 开始训练【双色球】红球模型...
2023-05-17 10:40:52.021 | INFO | main:train_ball_model:57 - 标签数据维度: (2996, 4, 6, 1)
0%| | 0/1 [00:00<?, ?it/s]Traceback (most recent call last):
File "D:\study\ml\predict_Lottery_ticket_pytorch-master\run_train_model.py", line 177, in
run(args.name, list_windows_size)
File "D:\study\ml\predict_Lottery_ticket_pytorch-master\run_train_model.py", line 124, in run
action(name)
File "D:\study\ml\predict_Lottery_ticket_pytorch-master\run_train_model.py", line 102, in action
train_ball_model(name, dataset=red_data, sub_name="红球")
File "D:\study\ml\predict_Lottery_ticket_pytorch-master\run_train_model.py", line 77, in train_ball_model
y_pred = model(x.float())
File "C:\Python310\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "D:\study\ml\predict_Lottery_ticket_pytorch-master\modeling.py", line 125, in forward
x = x.permute(1, 0, 2) # 将输入序列转置为 (seq_len, batch_size, input_size)
RuntimeError: permute(sparse_coo): number of dimensions in the tensor input does not match the length of the desired ordering of dimensions i.e. input.dim() = 4 is not equal to len(dims) = 3
0%| | 0/1 [00:00<?, ?it/s]

关于库和python版本问题

请问一定要用python3.8系统和tensflow2.3版本吗?如果用其他版本有哪些差距吗?主要是我的系统没法装ancode,在notebook上只支持python3.9,tensflow也只有2.13.版本,请问影响大吗?

大佬好 我想问一下 关于每轮训练数量的问题

大佬好,我想问一下,篮球或者红球训练次数多了以后,每轮训练数量不拉高就会很慢,我吧每轮训的练数量拉高之后,训练完以后是不能直接预测的,我还要吧每轮训的练数量设置成1,这样是不是吧我第一次的覆盖了。我用--predict_pro 1,或者吧蓝红球的训练次数拉低以后再训练,文件都会缩小...

我的指令是这样用的,是否有错。
第一种

  1. python run_train_model.py --name ssq --windows_size 3,5,7 --red_epochs 128 --blue_epochs 128 --batch_size 24
  2. python run_train_model.py --name ssq --windows_size 3,5,7 --predict_pro 1
    第二种
  3. python run_train_model.py --name ssq --windows_size 3,5,7 --red_epochs 128 --blue_epochs 128 --batch_size 24
  4. python run_train_model.py --name ssq --windows_size 3,5,7 --red_epochs 128 --blue_epochs 128 --batch_size 24 --predict_pro 1
    上面两种是正确的吗,不知道有没有办法解决这个问题

请问kl8_running的问题

请问kl8_running是批量生成往期数据吗?我运行了一天,好像它不会自动停止....另外请问kl8_running会自动调用kl8_cash取去验证吗?

感觉需要改进的地方

1:数据源,现在的数据源登录不上,建议使用17500,这么多年了还是很稳定的
2:预测结果,现在预测结果就是最新的一期,可以把历史预测也打印出来吗?比如说最近50期或者100期的预测结果【整个参数,动态设定】,最好是开奖结果和预测结果一起,这样能明显的看出来之前的预测的准确性
3:预测结果的数量,也整个动态的吧,比如说,每期预测5注号,10注号

未完待续,持续交流

快乐8预测了20个号

大佬,快乐8预测了20个号,但是从这20个号中选几个号的组合也太多了,能否推荐十个号

大佬有个想法,不知您觉得能否实现。

最近一直在找合适的参数,一开始命中率挺高,不知道如何找到的合适参数在连续几期验证之后严重跑偏,最近试了很多思路,依旧命中率降低,比如单轮次 多size,单size 多轮次等。
我想了想 也查询了下 Tensorflow 有反向传播算法,根据已知的数据逆向推导出相关的参数,然后再去正向预测,不知道这样的想法是否可行。我们可以通过历史数据,用最后一组逆推,依次迭代,至少逆推多次,找出合适的参数,再来验证。
我们每天对3d 排列三进行多参数的实验,但始终没有得到一个好的结果。

小小的建议,望作者大佬有空看一下,万分感谢

1、能不能自定义训练数据,有两点考量:①体彩摇奖机器从2019年12月有换新 ②想用最新一期已开奖号,对比调试合适的参数
2、config配置文件修改pls的轮数和每轮训练量貌似不生效,还是得执行的时候设置参数才行
3、高于1个batch_size训练后还得执行一遍才能预测,对于算力配置低的机器有点体验感差了。(心理作用,感觉用--predict_pro 1 参数会影响预测结果)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.