Lv.1
在 谁能给我讲讲朴素叶贝斯分类器是什么鬼! 中回复
import nltk import os from nltk.book import * import numpy from nltk import * from sklearn import * import easygui from nltk.corpus import stopwords english_stopwords = stopwords.words('english') xianyan = 0.5 ku = [] pass133 = os.getcwd() + "\\R" pass134 = os.getcwd() + "\\H" a = os.listdir(pass133) aa = os.listdir(pass134) txt_place= "" txt_text = "" htxt_place = "" htxt_text = "" print("开始学习!") for i in range(len(a)): ku_fu = [] txt_place = os.getcwd() + "\R" + "\\" + a[i] print(txt_place) txt_text = open(txt_place).read() txt_text = txt_text.lower() ku_fu = word_tokenize(txt_text) ku.extend(ku_fu) hku = [] for i in range(len(aa)): hku_fu = [] htxt_place =os.getcwd() + "\H" + "\\" + aa[i] print(htxt_place) htxt_text = open(htxt_place).read() htxt_text = htxt_text.lower() hku_fu = word_tokenize(htxt_text) hku.extend(hku_fu) print(hku) number = ["second","third","fourth","fifth","sixth","seventh","eighth","ninth","tenth"] ku_he = ku ciping = [] zuizhong = [] ku = [w for w in ku if w not in english_stopwords and len(w) >= 5 and w.isalpha() and w not in number] hku = [w for w in hku if w not in english_stopwords and len(w) >= 5 and w.isalpha() and w not in number] print(hku) fdist1 = FreqDist(ku) print(fdist1) zuizhong_fu = list(fdist1) print("INIT SUCCESS") for i in zuizhong_fu: zuizhong.append(i) if fdist1[i]/len(a) >= 1: ciping.append(1) elif fdist1[i]/len(a) < 1: ciping.append(float(fdist1[i]/len(a))) pass10 = input("词汇矩阵构建完成!点击enter开始测试垃圾邮件!") txt = easygui.fileopenbox(default='*.txt') text = open(txt).read() text = text.lower() text_fen = word_tokenize(text) text_fen = list(set(text_fen)) wenti = [] gongyou = [] for i in range(len(text_fen)): if text_fen[i] in zuizhong: gongyou.append(text_fen[i]) hwenti = [] for i in range(len(gongyou)): pass90 = hku.count(gongyou[i]) hwenti.append(pass90) for i in range(len(gongyou)): hwenti[i] = hwenti[i]/len(hku)*100 for i in range(len(gongyou)): wula = zuizhong.index(gongyou[i]) print("抽取:" + str(wula)) wenti.append(float(ciping[wula]*100)) zuihouha = []
就剩最后那个公式了,大佬帮帮我吧!
2018-01-05T21:39:10 点赞:0
在 【求助】能解释一下这个机器学习吗? 中回复
syn0 = 2*np.random.random((3,1)) - 1
这里一共有4个要预测的结果,可这里只输出了3个,这是不是代表这里有三个神经元呢?这些值是不是神经元的权重
2018-01-13T12:51:33 点赞:0
在 【求助】能解释一下这个机器学习吗? 中回复
def nonlin(x,deriv=False): if(deriv==True): return x*(1-x) return 1/(1+np.exp(-x))
这个函数是一个什么公式?有什么用?
2018-01-13T12:55:19 点赞:0
在 谁能给我讲讲朴素叶贝斯分类器是什么鬼! 中回复
那么联合概率公式呢?好像把这些都算出来求平均值不行。不太准,还有发我先假设一个词在健康邮件出现的概率很重要,对结果影响很大
2018-01-13T19:36:49 点赞:0
在 【求助】能解释一下这个机器学习吗? 中回复
现在在做一个颜值计算器,但是都是机器的审美。
能不能神经元算法,输入几张图片,人工打分。然后让他训练一张图片,不断地强化他的权重准确性。这样的算法该怎么写呢?
def nonlin(x,deriv=False):
if(deriv==True):
return x*(1-x)
else:
return 1/(1+np.exp(-x))
还有这个公式是干什么的?能用通俗的语言解释下吗?
而且这个模型,就是我们训练后的,权重值都很稳定,是不是就可以让他去计算别的东西了呢?怎么带入呢
2018-01-13T19:43:27 点赞:0
在 【求助】能解释一下这个机器学习吗? 中回复
主要问题就是训练完成以后就没有然后了,怎么用训练出来的数据去做那些预测呢?在没有标准答案的情况下。
还有图片转向量后无法和颜值向量兼容。压缩也不行
2018-01-13T20:50:01 点赞:0
在 【机器学习实验】继续请教大佬 中回复
那么图片是不是要手动分割出很多个组来呢?但那些组按理说应该都是非线性的无解的啊,所以有什么机器学习包可以学习图片的???
2018-01-20T11:52:08 点赞:0
在 【版本更新】编程猫积木实验室上线,人工智能AI来袭! 中回复
编程猫转python语言后,第一行是import codemao
怎么下载到codemao这个包呢?
2018-01-25T21:31:18 点赞:0
在 【版本更新】编程猫积木实验室上线,人工智能AI来袭! 中回复
博士,有了这个方便快捷创建神经网络的模块,我是不是局可以创建(维度*位置*颜色)层,然后喵学习那些照片
2018-01-25T23:09:55 点赞:0
在 【发布】百外聊天室重新出击! 中回复
我们那个群里做了一个个更厉害的,(其实性能一样功能一样我的还比他好些)。但是他的ui帅爆了,你们可以去看看,简直是666.(我的没ui)
2018-01-31T09:41:05 点赞:0