当前位置:网站首页>随机森林以及 AMR 训练出的诗词制造器
随机森林以及 AMR 训练出的诗词制造器
2022-06-28 10:54:00 【NikoDos】
AMR 即 Artificial mental retardation(即人工智障),是一种新兴的机器学习算法,旨在将最好的数据同通过百般蹂躏,变成一堆垃圾,下面将指导读者如何使用这种算法。
# 案例 诗词制造器
此案例较为简单,只需要运用到随机森林和 AMR 技术即可,难度在于有没有熟练掌握,贴源码。
import random
typ = input("请输入选择: 1.五言 2.七言")
data = [
'垂杨',
'新柳',
'玉丝纶',
'金嫩',
'柔条',
'曲岸垂杨',
'柳丝',
'闲柳',
'千花万柳',
'花海',
'芳甸吐嫩',
'摇绿',
'绿卷',
'浓翠',
'横翠',
'金碧',
'舒卷款款',
'片片',
'缕缕',
'落纷纷新晴',
'笼晴',
'韶光',
'婉媚',
'温丽',
'芊绵',
'春华',
'空灵',
'春柔',
'清婉',
'馨烈',
'和婉',
'清蕊',
'清芬',
'素约',
'红素',
'旖旎飞花',
'浮花',
'落英',
'花影',
'芳丛',
'浮香',
'锦花',
'绣草',
'烂漫',
'芳踪',
'镂玉',
'雕琼',
'繁枝',
'素景',
'密叶',
'稠花点水',
'扑面',
'风轻',
'水胧',
'倚暖胭脂色',
'水溶溶',
'不留痕',
'几点春',
'邀春驻',
'花映柳',
'花深浅',
'树高低',
'翻微风',
'香接天浓露飘香',
'软软东风',
'水逝云卷',
'繁花盈枝',
'百卉团团',
'和风轻暖',
'春光满树',
'秀色灼灼',
'红尘倦客',
'柳带摇风',
'香坠庭户',
'水阔花飞',
'瘦叶和风',
'叶叶心心',
'眼迷魂牵',
'浅粉深红',
]
def choose_word(num):
chose = []
for i in range(num):
chose.append(random.choice(data))
return chose
if int(typ) == 1:
sentence_list = []
for i in range(10):
chose = choose_word(2)
while len(chose[-1]) + len(chose[-2]) != 5:
chose = choose_word(2)
if len(chose[-1]) == 2 and len(chose[-2]) == 3:
sentence_list.append(chose[-1] + chose[-2])
elif len(chose[-1]) == 3 and len(chose[-2]) == 2:
sentence_list.append(chose[-2] + chose[-1])
print(sentence_list)
elif int(typ) == 2:
sentence_list = []
for i in range(10):
chose = choose_word(3)
while len(chose[-1]) + len(chose[-2]) != 7:
chose = choose_word(3)
sentence_list.append(chose[-1] + chose[-2])
print(sentence_list)
131 行代码,数据就占了一大半,这证明数据的庞大,考验了你的编码速度以及耐心。 下面的逻辑处理,使用了随机森林 random 高级库。
random.choice(list)此代码就是为了随机森林训练数据集,AMR 就体现于代码编写的愚蠢以及运行结果的 rubbish。
此算法的时间复杂度为 O (2^n),生成的诗皆为烂诗,为精品也。是 AMR 测试的好样本,随机森林的好榜样!
边栏推荐
- JS foundation 6
- Metersphere implements UI automation elements that are not clickable (partially occluded)
- 拼接String集合中的字符串_基于Stream
- 一款自动生成单元测试的 IDEA 插件,开发效率提升 70% 以上!
- Yann LeCun新论文:构建自动智能体之路
- Installing MySQL database (CentOS) in Linux source code
- Mysql database overview and installation process
- 【agora】get 一个 agora_refptr 对象的用法示例
- MySQL general binary installation method
- 无线通信模块定点传输-点对多点的具体传输应用
猜你喜欢

Dataease installation upgrade

Metersphere实现UI自动化元素不可点击(部分遮挡)

动态库(共享库)的制作和使用

【实操】Appium Settings app is not running after 5000ms

How to use K-line diagram for technical analysis

还在用 SimpleDateFormat 做时间格式化?小心项目崩掉!

Summary of spatial temporal time series prediction modeling methods

【monkey】monkey测试入门

DataEase安装升级

无线模块透明传输技术的物联网应用案例
随机推荐
Realization of a springboard machine
JS基础5
Guangzhou Customs supports the stable supply of food, agricultural products, traditional Chinese medicine and other civilian and biological resources to Hong Kong
【monkey】monkey测试入门
How does ETF position affect spot gold price?
fastposter v2.8.4 发布 电商海报生成器
MySQL查看数据库性能常用命令
Summary of characteristics of five wireless transmission protocols of Internet of things
压缩解压
Basic 02: variable, remember the mobile number of the object
Ffmpeg audio and video recording
sentinel
MarkDown——基本使用语法
Metersphere implements UI automation elements that are not clickable (partially occluded)
Several methods of using ABAP to operate Excel
Katalon全局变量在TestObject引用
JS基础1-JS引入与运算符
Does flink1.15 support MySQL views? I configured the view name at the table name to save, but the table could not be found. Think
AQS理解
Set up your own website (11)