Exemplo n.º 1
0
def gmain(ch="216501166744497073410"):
    from learn import Learn
    endtime = 128
    data = Learn().build_with_User_table_for_prog(slicer=endtime)
    print(len(data[0]))
    data = [(line[0], line[1],
             Wisard.retinify([
                 float(t) - float(t0) + 10
                 for t, t0 in zip(line[3:endtime], line[2:endtime])
             ])) for line in data]
    print(
        "Tabela gerada por rede neural sem peso para derivada segunda do tempo com prognóstico da carla"
    )
    # bleacher = dict(V=805, S=-6, E=81, F=154)
    # bleacher = dict(V=1485, S=-359, E=34, F=139) 199321270259550360019
    v, s, f, e, b, a, d =\
        int(ch[:4]), int(ch[4:7]), int(ch[7:10]), int(ch[10:13]), 0, 600, 10
    bleacher = dict(V=v, S=s, E=e, F=f)
    w = Wisard(data, 32 * endtime, bleach=b, mapper=bleacher, enf=a, sup=d)
    # bleacher = dict(V=893, S=-304, E=-48, F=25)
    # w = Wisard(data, 32 * endtime, bleach=995, mapper=bleacher, enf=452, sup=39, unsupervised=unsupervised)
    # bleacher = dict(V=603, S=0, E=81, F=154)
    # w = Wisard(data, 32 * endtime, bleach=600, mapper=bleacher, enf=110, sup=20)
    w.main()
    print(len(data[0][2:]))
Exemplo n.º 2
0
def main(_=0, unsupervised=False):
    from learn import Learn
    endtime = 128
    data = Learn().build_with_User_table_for_prog(slicer=endtime)
    print(len(data[0]))
    data = [(line[0], line[1],
             Wisard.retinify([
                 float(t) - float(t0) + 10
                 for t, t0 in zip(line[3:endtime], line[2:endtime])
             ])) for line in data]
    print(
        "Tabela gerada por rede neural sem peso para derivada segunda do tempo com prognóstico da carla"
    )
    # bleacher = dict(V=805, S=-6, E=81, F=154)
    # 83.36 16.64 v:2165, s:11, f:667, e:422, b:970, a:734, d:10
    bleacher = dict(V=1202, S=-15, E=59, F=165)  # 199321270259550360019
    # bleacher = dict(V=1615, S=-15, E=42, F=169)  # 199321270259550360019
    # bleacher = dict(V=2531, S=169, E=634, F=856)
    # w = Wisard(data, 32 * endtime, bleach=913, mapper=bleacher, enf=609, sup=18, unsupervised=unsupervised)
    w = Wisard(data,
               32 * endtime,
               bleach=913,
               mapper=bleacher,
               enf=600,
               sup=10,
               unsupervised=unsupervised)
    # bleacher = dict(V=893, S=-304, E=-48, F=25)
    # w = Wisard(data, 32 * endtime, bleach=995, mapper=bleacher, enf=452, sup=39, unsupervised=unsupervised)
    # bleacher = dict(V=603, S=0, E=81, F=154)
    # w = Wisard(data, 32 * endtime, bleach=600, mapper=bleacher, enf=110, sup=20)
    w.main()
    print(len(data[0][2:]))
    print(w.single())
    """
Exemplo n.º 3
0
 def init(self):
     self.colorlib = self.madcow.colorlib
     try:
         self.learn = Learn(madcow=madcow)
     except:
         self.learn = None
     self.google = Google()
Exemplo n.º 4
0
 def __init__(self, master=None):
     Application_ui.__init__(self, master)
     self.logger = MyLogger(log_board=self.log_board,
                            filename='all.log',
                            level='debug')
     self.learn = Learn(self.logger)
     self.t1 = None
Exemplo n.º 5
0
 def init(self):
     try:
         self.default_location = settings.YELP_DEFAULT_LOCATION
     except:
         self.default_location = DEFAULT_LOCATION
     try:
         self.learn = Learn(madcow=self.madcow)
     except:
         self.learn = None
Exemplo n.º 6
0
 def run(self):
     try:
         Learn(files=self.files, update_file=self.file, top=self.top)
     except:
         traceback.print_exc()
         exctype, value = sys.exc_info()[:2]
         self.signals.error.emit((exctype, value, traceback.format_exc()))
     else:
         self.signals.result.emit(None)
     finally:
         self.signals.finished.emit(True)
Exemplo n.º 7
0
    def init(self):
        opts = {}
        for key, default in self.defaults.iteritems():
            setting = 'WUNDERGROUND_' + key.upper()
            val = getattr(settings, setting, None)
            if val is None:
                val = default
            opts[key] = val

        self.api = WeatherUnderground(log=self.madcow.log, **opts)
        self.learn = Learn(madcow=self.madcow)
        self.method_triggers = [(getattr(self.api, method_name), triggers, pws)
                                for method_name, triggers, pws in self._method_triggers]
Exemplo n.º 8
0
 def __init__(self, tier, room, bot):
     self.learn = Learn(room)
     self.opponent = {}
     self.generation = "generation 6"
     self.bot = bot
     self.weather = ""
     self.statuses = []
     self.opponent_pokemon_team = []
     self.do_not_switch = False
     self.ws = self.bot.ws
     self.team = None
     self.strongest_move = ""
     self.active = ""
     self.id = ""
     self.tier = tier
     self.room = room
     self.turn = 0
Exemplo n.º 9
0
def open_app(app_name, cells, audio, arduino):
    current_app = None

    app_name = app_name.replace(" ", "")
    if app_name == 'riddles':
        current_app = Riddles("Riddles", cells, audio, arduino)
    elif app_name == 'learn':
        current_app = Learn("Learn", cells, audio, arduino)
    elif app_name == 'tutor':
        current_app = Tutor("Tutor", cells, audio, arduino)
    elif app_name == 'headlines':
        current_app = Headlines("Headlines", cells, audio, arduino)
    elif app_name == 'memory':
        current_app = Memory("Memory", cells, audio, arduino)

    if current_app is not None:
        audio.speak("Opening the application " + app_name)
        current_app.on_start()
    else:
        audio.speak(
            "I did not recognize the app. Could you try to open the app again?"
        )
Exemplo n.º 10
0
    def open_app(self, app_name):
        current_app = None

        app_name = app_name.replace(" ", "")
        if app_name == 'riddles':
            current_app = Riddles("Riddles")
        elif app_name == 'learn':
            current_app = Learn("Learn")
        elif app_name == 'tutor':
            current_app = Tutor("Tutor")
        elif app_name == 'headlines':
            current_app = Headlines("Headlines")
        elif app_name == 'memory':
            current_app = Memory("Memory")

        if current_app is not None:
            glob.mainApp.audio.speak("Opening the application")
            glob.mainApp.audio.speak(current_app.name)
            current_app.on_start()
        else:  # shouldn't occur
            glob.mainApp.audio.speak(
                "I did not recognize the app. Could you try to open the app again?"
            )
Exemplo n.º 11
0
 def __init__(self, madcow):
     self.learn = Learn(madcow)
Exemplo n.º 12
0
 def __init__(self, madcow=None):
     self.weather = Weather()
     try:
         self.learn = Learn(madcow=madcow)
     except:
         self.learn = None
Exemplo n.º 13
0
 def init(self):
     colorlib = self.madcow.colorlib
     self.weather = Weather(colorlib, self.log)
     self.learn = Learn(madcow=self.madcow)
Exemplo n.º 14
0
 def init(self):
     self.learn = Learn(madcow=self.madcow)
     self.staff = Staff(madcow=self.madcow)
Exemplo n.º 15
0
# Scheduler
scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,
                                                       mode='min',
                                                       factor=0.5,
                                                       patience=20,
                                                       verbose=False,
                                                       threshold=0.0001,
                                                       threshold_mode='rel',
                                                       cooldown=0,
                                                       min_lr=1e-07,
                                                       eps=1e-08)
# Learning class
learn = Learn(args,
              train_loader=train_loader,
              validate_loader=valid_loader,
              test_loader=test_loader,
              train_set=train_set,
              validate_set=valid_set,
              test_set=test_set)

# %%
# -----------------------------------------------------------
#
# Losses functions
#
# -----------------------------------------------------------
print('[Creating criterion]')
# Losses
if args.model in ['ae', 'vae', 'wae', 'vae-flow']:
    criterion = nn.MSELoss()
if args.num_classes > 1:
Exemplo n.º 16
0
 def __init__(self, madcow):
     self.learn = Learn(madcow)
     self.config = madcow.config
Exemplo n.º 17
0
 def init(self):
     self.colorlib = self.madcow.colorlib
     try:
         self.learn = Learn(madcow=self.madcow)
     except:
         self.learn = None
Exemplo n.º 18
0
 def init(self):
     self.learn = Learn(madcow=self.madcow)
     self.staff = Staff(madcow=self.madcow)
     self.company = Company(madcow=self.madcow)
     self.realname = Realname(madcow=self.madcow)
     self.notes = Notes(madcow=self.madcow)
Exemplo n.º 19
0
 def init(self):
     self.learn = Learn(self.madcow)
Exemplo n.º 20
0
from learn import Learn, Classification
import argparse
import curses

#the only extra argument is "learn" which is used to train the svm
parser = argparse.ArgumentParser(description='Recognize who is typing')
parser.add_argument('--learn',
                    help='teach the algorithm to recognize the user',
                    action='store_true')

args = parser.parse_args()
stdscr = curses.initscr()

#need to know the name of the user for predictive purposes
if args.learn:
    Learn(stdscr)
else:
    Classification(stdscr)
Exemplo n.º 21
0
from learn import Learn
from decimal import *
from re import findall
learn_path = "./new_train"
learn = Learn(learn_path)

# print(learn.number_of_bad_words, learn.number_of_good_words)
module = learn.number_of_good_words + learn.number_of_bad_words
probably_of_good_examp=Decimal(learn.number_of_good_example / learn.number_of_examles)
probably_of_bad_examp=Decimal(learn.number_of_bad_example / learn.number_of_examles)
CONST_OF_IMPORTANT=3


def probability_b(word):
    bad, good = 0, 0
    try:
        good = learn.good[word]
        bad = learn.bad[word]
    except:
        pass
    numb = bad+good
    if numb <= CONST_OF_IMPORTANT:
        return Decimal(0.5)
    return Decimal(bad/numb)


def probability_g(word):
    bad, good = 0, 0
    try:
        good = learn.good[word]
        bad = learn.bad[word]
Exemplo n.º 22
0
def main():
    Game = GameClass()
    Svs = Learn(100000)
    Game.Play(Svs)