• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python nn.searchnet函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nn.searchnet函数的典型用法代码示例。如果您正苦于以下问题:Python searchnet函数的具体用法?Python searchnet怎么用?Python searchnet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了searchnet函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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]))
开发者ID:Vendetta616,项目名称:WebCrawler,代码行数:7,代码来源:script.py


示例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])
开发者ID:wz125,项目名称:courses,代码行数:8,代码来源:run.py


示例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]
开发者ID:TUS-OSK,项目名称:Desire-AI,代码行数:8,代码来源:main.py


示例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
开发者ID:tayashigenori,项目名称:collective_intelligence,代码行数:11,代码来源:main.py


示例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)
开发者ID:tayashigenori,项目名称:collective_intelligence,代码行数:12,代码来源:main.py


示例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)
  '''
开发者ID:wz125,项目名称:courses,代码行数:13,代码来源:run.py


示例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)
开发者ID:Vendetta616,项目名称:WebCrawler,代码行数:13,代码来源:script.py


示例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:
开发者ID:takukawasaki,项目名称:searchEngine,代码行数:31,代码来源:flasky.py


示例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])
开发者ID:tayashigenori,项目名称:collective_intelligence,代码行数:5,代码来源:main.py


示例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])
开发者ID:tayashigenori,项目名称:collective_intelligence,代码行数:4,代码来源:main.py


示例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"'
开发者ID:Ignorant-Instigator,项目名称:collectiveintelligence-book,代码行数:31,代码来源:searchengine.py


示例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

开发者ID:nofacer,项目名称:SR-git,代码行数:9,代码来源:testnn.py


示例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")
开发者ID:houjingbiao,项目名称:Machine-Learning,代码行数:30,代码来源:main.py


示例14: __init__

	def __init__(self,dbname):
		self.con=sqlite.connect(dbname)
		self.mynet=nn.searchnet('nn.db')
开发者ID:zedoul,项目名称:randolphcarter,代码行数:3,代码来源:randolphcarter.py


示例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()
开发者ID:pbbhopp,项目名称:PCI,代码行数:18,代码来源:example.py


示例16: backpropagation

def backpropagation():
  mynet=nn.searchnet('nn.db')
  wWorld,wRiver,wBank =101,102,103
  uWorldBank,uRiver,uEarth =201,202,203
  mynet.trainquery([wWorld,wBank],[uWorldBank,uRiver,uEarth],uWorldBank)
  print mynet.getresult([wWorld,wBank],[uWorldBank,uRiver,uEarth])
开发者ID:wz125,项目名称:courses,代码行数:6,代码来源:run.py


示例17: querypage

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import bottle
import searchengine
import nn
import beaker.middleware
import os

mynet = nn.searchnet()

session_opts = {
    'session.type': 'file',
    'session.data_dir': './session/',
    'session.auto': True,
}
app = beaker.middleware.SessionMiddleware(bottle.app(), session_opts)

@bottle.route('/') 
def querypage():
    return bottle.template('query')

@bottle.route('/resume')
def resumepage():
    return bottle.template('resume')

@bottle.route('/query', method='POST')
def queryhandler():
    e = searchengine.searcher()
    q = bottle.request.forms.get("query")
    mywords, myurls = e.query(q)
开发者ID:shaunswanson,项目名称:hipsterpics,代码行数:31,代码来源:app.py


示例18: __init__

import urllib2
from BeautifulSoup import *
from urlparse import urljoin
from pysqlite2 import dbapi2 as sqlite
import nn
mynet=nn.searchnet('nn.db')

# Create a list of words to ignore
ignorewords={'the':1,'of':1,'to':1,'and':1,'a':1,'in':1,'is':1,'it':1}


class crawler:
  # Initialize the crawler with the name of database
  def __init__(self,dbname):
    self.con=sqlite.connect(dbname)

  def __del__(self):
    self.con.close()

  def dbcommit(self):
    self.con.commit()

  # Auxilliary function for getting an entry id and adding
  # it if it's not present
  def getentryid(self,table,field,value,createnew=True):
    cur=self.con.execute(
    "select rowid from %s where %s='%s'" % (table,field,value))
    res=cur.fetchone()
    if res==None:
      cur=self.con.execute(
      "insert into %s (%s) values ('%s')" % (table,field,value))
开发者ID:XuJingnan,项目名称:collective_intelligence,代码行数:31,代码来源:searchengine.py


示例19: neural_network

 def neural_network(self, rows, wordids):
     urlids = [urlid for urlid in set([row[0] for row in rows])]
     network_nel = nn.searchnet('nn.db')
     node_output = network_nel.getresult(wordids, urlids)
     net_score = dict([(urlids[i], node_output[i]) for i in range(len(urlids))])
     return self.normalizescores(net_score)
开发者ID:trungdung20,项目名称:searchengine,代码行数:6,代码来源:searchengine.py



注:本文中的nn.searchnet函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.NNBase类代码示例发布时间:2022-05-27
下一篇:
Python pipe.write函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap