当前位置: 首页 > news >正文

服务好的网站制作泰安网络犯罪案件

服务好的网站制作,泰安网络犯罪案件,南山网站设计电话,中关村在线官方网站对AI炒股感兴趣的小伙伴可加WX#xff1a;caihaihua057200#xff08;备注#xff1a;学校/公司名字方向#xff09; 另外我还有些AI的应用可以一起研究#xff08;我一直开源代码#xff09; 1、引言 在这期内容中#xff0c;我们回到AI预测股票#xff0c;转而探索… 对AI炒股感兴趣的小伙伴可加WXcaihaihua057200备注学校/公司名字方向 另外我还有些AI的应用可以一起研究我一直开源代码 1、引言 在这期内容中我们回到AI预测股票转而探索人工智能技术如何应用于另一个有趣的领域预测A股大盘。 2、AI与股票的关系 在股票预测中AI充当着数据分析和模式识别的角色。虽然无法确保百分之百准确的结果但它为增加预测的洞察力和理解提供了全新的途径。 3、数据收集与处理akshare爬实时上证指数 import akshare as ak import numpy as np import pandas as pd from pandas.tseries.offsets import CustomBusinessDay from datetime import datetime import xgboost as xgbdf ak.stock_zh_index_daily_em(symbolsh000001) 数据预处理时间特征转换及时间特征结合K线特征 today datetime.today() date_str today.strftime(%Y%m%d) base int(datetime.strptime(date_str, %Y%m%d).timestamp()) change1 lambda x: (int(datetime.strptime(x, %Y%m%d).timestamp()) - base) / 86400 change2 lambda x: (datetime.strptime(str(x), %Y%m%d)).day change3 lambda x: datetime.strptime(str(x), %Y%m%d).weekday()df[date] df[date].str.replace(-, ) X df[date].apply(lambda x: change1(x)).values.reshape(-1, 1) X_month_day df[date].apply(lambda x: change2(x)).values.reshape(-1, 1) X_week_day df[date].apply(lambda x: change3(x)).values.reshape(-1, 1) XX np.concatenate((X, X_week_day, X_month_day), axis1)[29:] FT np.array(df.drop(columns[date])) min_vals np.min(FT, axis0) max_vals np.max(FT, axis0) FT (FT - min_vals) / (max_vals - min_vals)window_size 30 num_rows, num_columns FT.shape new_num_rows num_rows - window_size 1 result1 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.mean(window, axis0)result1[i] window_meanresult2 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.max(window, axis0)result2[i] window_meanresult3 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.min(window, axis0)result3[i] window_meanresult4 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.std(window, axis0)result4[i] window_mean result_list [result1, result2, result3, result4] result np.hstack(result_list)XX np.concatenate((XX, result), axis1) 4、预测模型XGboots y1 df[open][29:] y2 df[close][29:] y3 df[high][29:] y4 df[low][29:] models1 xgb.XGBRegressor() models2 xgb.XGBRegressor() models3 xgb.XGBRegressor() models4 xgb.XGBRegressor() models1.fit(XX, y1) models2.fit(XX, y2) models3.fit(XX, y3) models4.fit(XX, y4) 5、应用及画图 start_date pd.to_datetime(today)bday_cn CustomBusinessDay(weekmaskMon Tue Wed Thu Fri) future_dates pd.date_range(startstart_date, periods6, freqbday_cn) future_dates_str [date.strftime(%Y-%m-%d) for date in future_dates][1:] future_dates_str pd.Series(future_dates_str).str.replace(-, ) X_x future_dates_str.apply(lambda x: change1(x)).values.reshape(-1, 1) X_month_day_x future_dates_str.apply(lambda x: change2(x)).values.reshape(-1, 1) X_week_day_x future_dates_str.apply(lambda x: change3(x)).values.reshape(-1, 1) XXX np.concatenate((X_x, X_week_day_x, X_month_day_x), axis1) last_column result[-1:, ] repeated_last_column np.tile(last_column, (5, 1)) result repeated_last_columnXXX np.concatenate((XXX, result), axis1) pred1 models1.predict(XXX) pred2 models2.predict(XXX) pred3 models3.predict(XXX) pred4 models4.predict(XXX)y1 np.array(df[open][-30:]) y2 np.array(df[close][-30:]) y3 np.array(df[high][-30:]) y4 np.array(df[low][-30:]) YD np.array(df[date][-30:])data {open: np.concatenate([y1, pred1]),close: np.concatenate([y2, pred2]),high: np.concatenate([y3, pred3]),low: np.concatenate([y4, pred4]),date:np.concatenate([YD,np.array(future_dates_str)]) }df pd.DataFrame(data)import mplfinance as mpf# df[date] pd.date_range(startRQ, periodslen(df)) df[date] pd.to_datetime(df[date]) df.set_index(date, inplaceTrue) # mpf.plot(df, typecandle, titleStock K-Line) my_color mpf.make_marketcolors(upred, # 上涨时为红色downgreen, # 下跌时为绿色# edgei, # 隐藏k线边缘# volumein, # 成交量用同样的颜色inheritTrue)my_style mpf.make_mpf_style(# gridaxisboth, # 设置网格# gridstyle-.,# y_on_rightTrue,marketcolorsmy_color)mpf.plot(df, typecandle,stylemy_style,# datetime_format%Y年%m月%d日,titleStock K-Line) 6、结果预测下周上证图中后五天是预测结果 总结图中所示 1、周一到周三略微上涨一点点。 2、下周四五高开高走令人惊讶。 如果提前布局的话应该是选择在周四找最低点买入。 全代码一件运行 import akshare as ak import numpy as np import pandas as pd from pandas.tseries.offsets import CustomBusinessDay from datetime import datetime import xgboost as xgbdf ak.stock_zh_index_daily_em(symbolsh000001)today datetime.today() date_str today.strftime(%Y%m%d) base int(datetime.strptime(date_str, %Y%m%d).timestamp()) change1 lambda x: (int(datetime.strptime(x, %Y%m%d).timestamp()) - base) / 86400 change2 lambda x: (datetime.strptime(str(x), %Y%m%d)).day change3 lambda x: datetime.strptime(str(x), %Y%m%d).weekday()df[date] df[date].str.replace(-, ) X df[date].apply(lambda x: change1(x)).values.reshape(-1, 1) X_month_day df[date].apply(lambda x: change2(x)).values.reshape(-1, 1) X_week_day df[date].apply(lambda x: change3(x)).values.reshape(-1, 1) XX np.concatenate((X, X_week_day, X_month_day), axis1)[29:] FT np.array(df.drop(columns[date])) min_vals np.min(FT, axis0) max_vals np.max(FT, axis0) FT (FT - min_vals) / (max_vals - min_vals)window_size 30 num_rows, num_columns FT.shape new_num_rows num_rows - window_size 1 result1 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.mean(window, axis0)result1[i] window_meanresult2 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.max(window, axis0)result2[i] window_meanresult3 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.min(window, axis0)result3[i] window_meanresult4 np.empty((new_num_rows, num_columns)) for i in range(new_num_rows):window FT[i: i window_size]window_mean np.std(window, axis0)result4[i] window_mean result_list [result1, result2, result3, result4] result np.hstack(result_list)XX np.concatenate((XX, result), axis1)y1 df[open][29:] y2 df[close][29:] y3 df[high][29:] y4 df[low][29:] models1 xgb.XGBRegressor() models2 xgb.XGBRegressor() models3 xgb.XGBRegressor() models4 xgb.XGBRegressor() models1.fit(XX, y1) models2.fit(XX, y2) models3.fit(XX, y3) models4.fit(XX, y4)start_date pd.to_datetime(today)bday_cn CustomBusinessDay(weekmaskMon Tue Wed Thu Fri) future_dates pd.date_range(startstart_date, periods6, freqbday_cn) future_dates_str [date.strftime(%Y-%m-%d) for date in future_dates][1:] future_dates_str pd.Series(future_dates_str).str.replace(-, ) X_x future_dates_str.apply(lambda x: change1(x)).values.reshape(-1, 1) X_month_day_x future_dates_str.apply(lambda x: change2(x)).values.reshape(-1, 1) X_week_day_x future_dates_str.apply(lambda x: change3(x)).values.reshape(-1, 1) XXX np.concatenate((X_x, X_week_day_x, X_month_day_x), axis1) last_column result[-1:, ] repeated_last_column np.tile(last_column, (5, 1)) result repeated_last_columnXXX np.concatenate((XXX, result), axis1) pred1 models1.predict(XXX) pred2 models2.predict(XXX) pred3 models3.predict(XXX) pred4 models4.predict(XXX)y1 np.array(df[open][-30:]) y2 np.array(df[close][-30:]) y3 np.array(df[high][-30:]) y4 np.array(df[low][-30:]) YD np.array(df[date][-30:])data {open: np.concatenate([y1, pred1]),close: np.concatenate([y2, pred2]),high: np.concatenate([y3, pred3]),low: np.concatenate([y4, pred4]),date:np.concatenate([YD,np.array(future_dates_str)]) }df pd.DataFrame(data)import mplfinance as mpf# df[date] pd.date_range(startRQ, periodslen(df)) df[date] pd.to_datetime(df[date]) df.set_index(date, inplaceTrue) # mpf.plot(df, typecandle, titleStock K-Line) my_color mpf.make_marketcolors(upred, # 上涨时为红色downgreen, # 下跌时为绿色# edgei, # 隐藏k线边缘# volumein, # 成交量用同样的颜色inheritTrue)my_style mpf.make_mpf_style(# gridaxisboth, # 设置网格# gridstyle-.,# y_on_rightTrue,marketcolorsmy_color)mpf.plot(df, typecandle,stylemy_style,# datetime_format%Y年%m月%d日,titleStock K-Line)
http://www.dnsts.com.cn/news/278169.html

相关文章:

  • 贵阳网站制作建设本网站只做信息展示不提供在线交易
  • 福田公司成立时间江门做网站seo的
  • wordpress 打赏阅读绍兴网站建设seo
  • 东台网站建设服务商解决方案服务商
  • 旅行社手机网站建设网站后台上传图片脚本错误
  • 如何用js做网站服务公司荡神
  • 做网站找模板去哪好做网站的积木式编程
  • 开通网站的会计科目怎么做wordpress阿里百秀
  • 平凉北京网站建设买医疗产品的网站建设
  • 电子商务电商网站饿建设莱芜金点子招聘信息
  • 做网站哪个公司好公司登记
  • 网站建设技术员合肥那个公司做网站优化好
  • 怎么查看网站后台地址网页设计与网站建设完全实战手册
  • 网络科技公司网站源码下载互联网专线做网站怎么做数据
  • 网站建设做的人多吗最新网站建设软件
  • 茂名网站建设方案推广森东网站建设
  • 湖州网站建设公司环球设计官网网站
  • 做营销型网站多少钱松门建设规划局网站
  • 宿州网站建设多少钱专业的网站优化公司
  • 游戏网站平台大全游戏网本地视频做成链接网址
  • 自助网站建设哪家好北京网站优化和推广
  • 宝安建网站域名和网站一样吗
  • 有些公司做网站比较好的wordpress过滤器插件6
  • 宁波网站建设论坛引流推广平台
  • 临猗县 保障住房和建设住建网站商品网站模板
  • 国家示范校建设网站网站开发建设流程
  • 企业网站建站的专业性原则是指自助建站的软件
  • 网站项目需求表梁山城乡建设局网站
  • 网站建设公司中网站布局有哪些常见的
  • 网站续费收多少合适网站建设模版文档