优化随机数算法

main
roger 1 year ago
parent 8246393ace
commit 1334c16189
  1. 2
      blue_forecast.py
  2. 2
      blue_total_rate.py
  3. 2
      new_blue_forecast.py
  4. 0
      orm/blue_forecast.py
  5. 0
      orm/main.py
  6. 79
      orm/orm_db.py
  7. 0
      orm/real_index.py
  8. 0
      orm/red_forecast.py
  9. 2
      real_index.py
  10. 2
      red_forecast.py

@ -4,7 +4,7 @@ from functools import reduce
from pymysql.cursors import DictCursor from pymysql.cursors import DictCursor
db = { db = {
'host': 'home.rogersun.online', 'host': 'home.rogersun.cn',
'user': 'root', 'user': 'root',
'password': 'Sxzgx1209', 'password': 'Sxzgx1209',
'database': 'lottery' 'database': 'lottery'

@ -5,7 +5,7 @@ from blue_forecast import dict_sort, dict_rate
from pymysql.cursors import DictCursor from pymysql.cursors import DictCursor
db = { db = {
'host': 'home.rogersun.online', 'host': 'home.rogersun.cn',
'user': 'root', 'user': 'root',
'password': 'Sxzgx1209', 'password': 'Sxzgx1209',
'database': 'lottery' 'database': 'lottery'

@ -5,7 +5,7 @@ from functools import reduce
from pymysql.cursors import DictCursor from pymysql.cursors import DictCursor
db = { db = {
'host': 'home.rogersun.online', 'host': 'home.rogersun.cn',
'user': 'root', 'user': 'root',
'password': 'Sxzgx1209', 'password': 'Sxzgx1209',
'database': 'lottery' 'database': 'lottery'

@ -0,0 +1,79 @@
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import declarative_base
from sqlalchemy import Column, Integer, String, DATE
# 创建数据引擎
DB_URI = "mysql+pymysql://root:Sxzgx1209@home.rogersun.cn:3306/lottery"
engine = create_engine(DB_URI, echo=True)
# 生成基类
Base = declarative_base()
# 生成数据表对象
class History(Base):
__tablename__ = 'history' # 定义表名
# 定义表结构
id = Column(Integer, autoincrement=True, primary_key=True)
dateId = Column(String(20), nullable=False)
openDate = Column(DATE, nullable=False)
red = Column(String(200), nullable=False)
blue = Column(String(10), nullable=False)
class BlueForecastFiveAll(Base):
__tablename__ = 'blue_forecast_five_all' # 定义表名
# 定义表结构
id = Column(Integer, autoincrement=True, primary_key=True)
dateId = Column(String(20), nullable=False, comment='期号')
real_blue = Column(String(10), comment='真实的蓝球数据')
prv_five = Column(String(500), nullable=False, comment='根据当前一期的蓝球,从历史数据中往前推5期,计算蓝球出现概率')
prv_index = Column(Integer, comment='根据实际结果计算蓝球的index位置')
post_five = Column(String(500), nullable=False, comment='根据当前一期的蓝球,从历史数据中往后推5期,计算蓝球出现概率')
post_index = Column(Integer, comment='根据实际结果计算蓝球的index位置')
history_total = Column(String(500), nullable=False, comment='根据当前一期的蓝球,从历史数据中计算每个蓝球出现的概率')
history_index = Column(Integer, comment='历史中的蓝球索引')
class BlueForecastThreeAll(Base):
__tablename__ = 'blue_forecast_three_all' # 定义表名
# 定义表结构
id = Column(Integer, autoincrement=True, primary_key=True)
dateId = Column(String(20), nullable=False, comment='期号')
real_blue = Column(String(10), comment='真实的蓝球数据')
prv_three = Column(String(500), nullable=False, comment='根据当前一期的蓝球,从历史数据中往前推5期,计算蓝球出现概率')
prv_index = Column(Integer, comment='根据实际结果计算蓝球的index位置')
post_three = Column(String(500), nullable=False,
comment='根据当前一期的蓝球,从历史数据中往后推5期,计算蓝球出现概率')
post_index = Column(Integer, comment='根据实际结果计算蓝球的index位置')
history_total = Column(String(500), nullable=False, comment='根据当前一期的蓝球,从历史数据中计算每个蓝球出现的概率')
history_index = Column(Integer, comment='历史中的蓝球索引')
class RedForecastAll(Base):
__tablename__ = 'red_forecast_all' # 定义表名
# 定义表结构
id = Column(Integer, autoincrement=True, primary_key=True)
dateId = Column(String(20), nullable=False, comment='期号-指预测数据根据哪一期数据计算')
red_rate = Column(String(500), nullable=False, comment='根据上一期红球结果计算历史中红球的出现概率')
random_red_num = Column(String(256), comment='随机计算的红球数据')
random_red_index = Column(String(256), comment='预测红球数据对应的index')
random_red_index_group = Column(String(256), comment='预测红球数据对应的index分布')
real_red = Column(String(256), comment='下一期的真实的红球数据')
real_red_index = Column(String(100), comment='真实红球在此次预测中的索引位置')
real_red_index_group = Column(String(100), comment='真实红球在此次预测中的索引位置的分布')
# 创建数据表,下面部分没有联想
Base.metadata.create_all(engine)
from sqlalchemy.orm import sessionmaker
Session_class = sessionmaker(bind=engine) # 创建与数据引擎的绑定会话类
session = Session_class() # 实例化session连接

@ -4,7 +4,7 @@ from functools import reduce
from pymysql.cursors import DictCursor from pymysql.cursors import DictCursor
db = { db = {
'host': 'home.rogersun.online', 'host': 'home.rogersun.cn',
'user': 'root', 'user': 'root',
'password': 'Sxzgx1209', 'password': 'Sxzgx1209',
'database': 'lottery' 'database': 'lottery'

@ -7,7 +7,7 @@ from blue_forecast import dict_sort, dict_rate
from lottery_random import new_num from lottery_random import new_num
db = { db = {
'host': 'home.rogersun.online', 'host': 'home.rogersun.cn',
'user': 'root', 'user': 'root',
'password': 'Sxzgx1209', 'password': 'Sxzgx1209',
'database': 'lottery' 'database': 'lottery'

Loading…
Cancel
Save