def __init__(self, block_images, item_images, mob_images): """ Construct a new ViewRouter with appropriate entity id to image file mappings. Parameters: block_images (dict<str: str>): A mapping of block ids to their respective images item_images (dict<str: str>): A mapping of item ids to their respective images mob_images (dict<str: str>): A mapping of mob ids to their respective images """ super().__init__(block_images, item_images, mob_images) loader = SpriteSheetLoader() self._images = loader.load_all() self._mario_count = 0 self._mario_speed = 8 self._player_facing = 1 self._mob_count = {} self._mob_speed = {} self._mob_death = {} self._bouncy_count = {} self._bouncy_speed = {} self._bouncy_activated = {} self._coin_count = {} self._coin_speed = {}
def setUpClass(self): print("This setUpClass() method only called once.") model = load_all() self.model_IfKnowDebtor = model['IfKnowDebtor'] self.model_CutDebt = model['CutDebt'] self.model_IDClassifier = model['IDClassifier'] self.model_WillingToPay = model['WillingToPay'] self.model_Installment = model['Installment'] self.model_ConfirmLoan = model['ConfirmLoan'] self.df = pd.read_excel('ConfirmLoan.xls')
import time import json import loader import numpy as np from sklearn.metrics import accuracy_score from sklearn.experimental import enable_hist_gradient_boosting from sklearn.ensemble import HistGradientBoostingClassifier if __name__ == "__main__": # No randomness is introduced in HGBDT when `X_train` and `X_test` # are fixed. n_jobs = -1 load_funcs = loader.load_all() config = json.load(open("config.json", "r")) records = [] for dataset, func in load_funcs.items(): if dataset in ("sector"): # run out of memory on sector continue if dataset not in config: msg = "Missing configuration in json file for dataset = {}." raise RuntimeError(msg.format(dataset)) X_train, y_train, X_test, y_test = func() n_classes = np.unique(y_train).shape[0] objective = ('categorical_crossentropy' if n_classes > 2 else 'binary_crossentropy')
# Assign member ids to new members # import sys import os from pythoncivicrm.pythoncivicrm import CiviCRM from pythoncivicrm.pythoncivicrm import CivicrmError from pythoncivicrm.pythoncivicrm import matches_required from loader import load_all site_key = os.environ['CIVI_SITE_KEY'] api_key = os.environ['CIVI_API_KEY'] url = os.environ['CIVI_API_URL'] civicrm = CiviCRM(url, site_key, api_key, True) members = load_all(civicrm, 1, 200) #run through all contacts and determine the current highest member id print('Determining highest current member id...'); high_member_id = 0 for member in members: print('Current member id ' + str(member.member_id)) print('Highest member id ' + str(high_member_id)) if member.member_id > high_member_id: high_member_id = member.member_id print('Highest assigned member id is currently ' + str(high_member_id)) exit #run through all contacts and assign new member ids where necessary print('Assigning new member ids...');
import sys,os sys.path.append('../../MLModel/code/OneClickTraining/') sys.path.append('../../MLModel/code/TreeModelV2/') import sys,os loader_path = '../../classifier/loader/' sys.path.append(loader_path) from loader import load_all model_dict=load_all() from MLModel.code.OneClickTraining.all_model_py import * from MLModel.code.TreeModelV2.chatbotv1 import * class chatbot_engine(object): def __init__(self): models_list = ['IDClassifier', 'CutDebt', 'IfKnowDebtor', 'WillingToPay', 'Installment', 'ConfirmLoan'] savedModel_path = '../../classifier/saved_Model/{}/main_flow/{}.pkl' model_dict = {} for each_model in models_list: model_dict[each_model] = pickle.load(open(savedModel_path.format(each_model, each_model), 'rb')) # model_dict[each_model].classify('再说一次') # model_dict['StopClassifier'] = StopClassifier() # model_dict['InitClassifier'] = InitClassifier() # def models(): # models_list = ['IDClassifier', 'CutDebt', 'IfKnowDebtor', 'WillingToPay', 'Installment', 'ConfirmLoan'] # savedModel_path = '../../MLModel/saved_Model/{}/main_flow/{}.pickle' # model_dict = {}
# from HRX.Test.chatbot_model import models import sys, os loader_path = '../../classifier/loader/' sys.path.append(loader_path) from loader import load_all # model_dict=load_all() import unittest import HTMLTestRunner # 导入HTMLTestRunner模块 import pandas as pd all_error = [] columns = ['split_text', 'classifier', 'label', 'predict_label'] import re model = load_all() read_path = '../../MLModel/data/{}/mock_up_data_clean_new.csv' save_path = '/Users/ozintel/Downloads/Tsl_work_file/Collect_project_file/chatbot/cmc/数据清洗2018_7_31/cleaned_data_2018_8_2/intersection_data_process/data_submit' class chatBotModel(object): """Test chatbot_ttest_model.py""" def __init__(self): # print("This setUpClass() method only called once.") # self.model_IfKnowDebtor = model['IfKnowDebtor'] # self.model_CutDebt = model['CutDebt'] # self.model_IDClassifier = model['IDClassifier'] # self.model_WillingToPay = model['WillingToPay'] # self.model_Installment = model['Installment']