本文整理汇总了Python中nn.searchnet函数的典型用法代码示例。如果您正苦于以下问题:Python searchnet函数的具体用法?Python searchnet怎么用?Python searchnet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了searchnet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nn2
def nn2():
import nn
wWorld,wRiver,wBank = 101,102,103
uWorldBank,uRiver,uEarth = 201,202,203
mynet = nn.searchnet("nn.db")
print(mynet.getresult([wWorld,wBank],[uWorldBank,uRiver,uEarth]))
示例2: onclick
def onclick():
mynet=nn.searchnet('nn.db')
wWorld,wRiver,wBank =101,102,103
uWorldBank,uRiver,uEarth =201,202,203
mynet.generatehiddennode([wWorld,wBank],[uWorldBank,uRiver,uEarth])
for c in mynet.con.execute('select * from wordhidden'): print c
for c in mynet.con.execute('select * from hiddenurl'): print c
print mynet.getresult([wWorld,wBank],[uWorldBank,uRiver,uEarth])
示例3: __init__
def __init__(self):
self.net = nn.searchnet('gridwar.db')
# self.net.maketables()
self.oUP = 0
self.oDown = 1
self.oLeft = 2
self.oRight = 3
self.outputs = [self.oUP, self.oDown, self.oLeft, self.oRight]
示例4: test_select
def test_select():
sys.stderr.write("testing create hiddennodes...\n")
mynet=nn.searchnet('nn.db')
mynet.maketables()
wWorld,wRiver,wBank =101,102,103
uWorldBank,uRiver,uEarth =201,202,203
mynet.generatehiddennode([wWorld,wBank],[uWorldBank,uRiver,uEarth])
sys.stderr.write("testing 'select * from wordhidden'...\n")
for c in mynet.con.execute('select * from wordhidden'): print c
sys.stderr.write("testing 'select * from hiddenurl'...\n")
for c in mynet.con.execute('select * from hiddenurl'): print c
示例5: test_trainqueries
def test_trainqueries():
sys.stderr.write("testing training queries...\n")
mynet=nn.searchnet('nn.db')
allurls=[uWorldBank,uRiver,uEarth]
for i in range(30):
mynet.trainquery([wWorld,wBank],allurls,uWorldBank)
mynet.trainquery([wRiver,wBank],allurls,uRiver)
mynet.trainquery([wWorld],allurls,uEarth)
print mynet.getresult([wWorld,wBank],allurls)
print mynet.getresult([wRiver,wBank],allurls)
print mynet.getresult([wBank],allurls)
示例6: trainingTest
def trainingTest():
mynet=nn.searchnet('nn.db')
wWorld,wRiver,wBank =101,102,103
uWorldBank,uRiver,uEarth =201,202,203
allurls=[uWorldBank,uRiver,uEarth]
for i in range(30):
mynet.trainquery([wWorld,wBank],allurls,uWorldBank)
mynet.trainquery([wRiver,wBank],allurls,uRiver)
mynet.trainquery([wWorld],allurls,uEarth)
print mynet.getresult([wWorld,wBank],allurls)
print mynet.getresult([wRiver,wBank],allurls)
print mynet.getresult([wBank],allurls)
'''
示例7: nn
def nn():
import nn
mynet = nn.searchnet("nn.db")
mynet.maketables()
wWorld,wRiver,wBank = 101,102,103
uWorldBank,uRiver,uEarth = 201,202,203
mynet.generatehiddennode([wWorld,wBank],[uWorldBank,uRiver,uEarth])
for c in mynet.con.execute("select * from wordhidden"):
print(c)
for c in mynet.con.execute("select * from hiddenurl"):
print(c)
示例8: makeindex
#!/Users/kawasakitaku/Documents/python-PVM/ln-python3.4/bin/python3.4
import searchengine as s
import nn
from flask import Flask
from flask import render_template, request
import os
mynet = nn.searchnet("nn.db")
tempate = os.path.join(os.getcwd(),'templates')
app = Flask(__name__,template_folder=tempate)
def makeindex(key):
e = s.searcher('searchindex.db')
result = e.query(key)
List = []
size = len(result)
for i in range(size):
for j in result[i]:
List.append(e.geturlname(j))
return List
@app.route('/',methods=['GET','POST'])
def index():
if request.method == 'POST':
keyword = request.form['keyword']
res_list = makeindex(keyword)
if keyword:
示例9: test_trainquery
def test_trainquery():
sys.stderr.write("testing training query...\n")
mynet=nn.searchnet('nn.db')
mynet.trainquery([wWorld,wBank],[uWorldBank,uRiver,uEarth],uWorldBank)
print mynet.getresult([wWorld,wBank],[uWorldBank,uRiver,uEarth])
示例10: test_feedforward
def test_feedforward():
sys.stderr.write("testing feedforward (without training)...\n")
mynet=nn.searchnet('nn.db')
print mynet.getresult([wWorld,wBank],[uWorldBank,uRiver,uEarth])
示例11: __init__
import os
import re
import urllib2
import urlparse
from pysqlite2 import dbapi2 as sqlite
from BeautifulSoup import BeautifulSoup
import nn
net = nn.searchnet('nn.db') # XXX: somehow train this from user clicks
ignorewords = set(['the', 'of', 'to', 'and', 'a', 'in', 'is', 'it'])
# XXX: the root page (amnoid.de) is indexed twice for some reason (e.g.
# select * from links where toid = 2;
# shows the link 1->2 two times.
class crawler:
def __init__(self, dbname):
self.con = sqlite.connect(dbname)
def __del__(self):
self.con.close()
def dbcommit(self):
self.con.commit()
def getentryid(self, table, field, value, createnew=True):
"""Returns an entry id and creates it if it is not present."""
cur = self.con.execute('select rowid from %s where %s="%s"'
示例12:
#coding=utf-8
import nn
mynet=nn.searchnet('nn.db')#创建数据库
#mynet.maketables()#创建数据表
wWorld,wRiver,wBank=101,102,103
uWorldBank,uRiver,uEarth=201,202,203
mynet.generatehiddennode([wWorld,wBank],[uWorldBank,uRiver,uEarth])
for c in mynet.con.execute('select * from wordhidden'): print c
for c in mynet.con.execute('select * from hiddenurl'): print c
示例13:
# crawler.createindextables()
crawler = searchengine.crawler("searchindex.db")
# crawler.createindextables()
# pages=['http://kiwitobes.com/wiki/Categorical_list_of_programming_languages.html']
# crawler.crawl(pages)
# crawler.calculatepagerank()
# search
# e=searchengine.searcher('searchindex.db')
# e.query('function programming')
import nn
mynn = nn.searchnet("nndb.db")
# mynn.maketables()
kaka1 = mynn.getstrength(0, 5, 0)
kaka1 = mynn.getstrength(0, 5, 1)
mynn.setstrength(0, 5, 0, 3)
mynn.setstrength(0, 5, 1, 2)
kaka1 = mynn.getstrength(0, 5, 0)
kaka1 = mynn.getstrength(0, 5, 1)
print("Hello World")
示例14: __init__
def __init__(self,dbname):
self.con=sqlite.connect(dbname)
self.mynet=nn.searchnet('nn.db')
示例15: get_ipython
get_ipython().magic(u"logstart example.py append")
import nn
online, pharmacy = 1, 2
spam, notspam = 1, 2
possible = [spam, notspam]
neuralnet = nn.searchnet("nntest.db")
neuralnet.maketables()
neuralnet.trainquery([online], possible, notspam)
neuralnet.trainquery([online, pharmacy], possible, spam)
neuralnet.trainquery([pharmacy], possible, notspam)
neuralnet.getresult([online, pharmacy], possible)
neuralnet.getresult([online], possible)
neuralnet.trainquery([online], possible, notspam)
neuralnet.getresult([online], possible)
neuralnet.trainquery([online], possible, notspam)
neuralnet.getresult([online], possible)
quit()