예제 #1
0
def binLocation(binNumber, productList):
    if binNumber == 1:
        bin1 = Final.Bin(productList)
        return print(bin1)
    if binNumber == 2:
        bin2 = Final.Bin(productList)
        return print(bin2)
    if binNumber == 3:
        bin3 = Final.Bin(productList)
        return bin3
    if binNumber == 4:
        bin4 = Final.Bin(productList)
        return bin4
    if binNumber == 5:
        bin5 = Final.Bin(productList)
        return bin5
    if binNumber == 6:
        bin6 = Final.Bin(productList)
        return bin6
    if binNumber == 7:
        bin7 = Final.Bin(productList)
        return bin7
    if binNumber == 8:
        bin8 = Final.Bin(productList)
        return bin8
    if binNumber == 9:
        bin9 = Final.Bin(productList)
        return bin9
    if binNumber == 10:
        bin10 = Final.Bin(productList)
        return bin10
예제 #2
0
def main():
    try:
        output_file = open('Final_output_result.txt', 'w')
        print('start:\nlearning rate has been set to:{}\niteration criteria'
            ' has been set to:{}\n'.format(learning_rate, epoch))
        print(
            'error criteria has been set to:{}\nmomentum has been set to:{}\nbias has been set to:{}'.format(error_criteria,
                                                                                                            momentum,
                                                                                                            bias))
        print(
            'start:\nlearning rate has been set to:{}\niteration criteria has been set to:{}'.format(learning_rate, epoch),
            file=output_file)
        print(
            'error criteria has been set to:{}\nmomentum has been set to:{}\nbias has been set to:{}'.format(error_criteria,
                                                                                                            momentum,
                                                                                                            bias),
            file=output_file)
        d = Dt.Data(train_file, test_file, output_file, epsilon)
        ##TODO training phase
        d.arrange_train()
        # d_final = d.split_desire(d.get_desire())  # a dictionary that contains all the desire output
        d_final = d.get_desire()
        d.arrange_test()
        print("1 input layer, 1 hidden layer, 1 output layer\n")
        print("1 input layer, 1 hidden layer, 1 output layer\n", file=output_file)
        print("the number of input node is: {}, hidden node is: {}, output node is: {}\n".format(input_node, hidden_node,
                                                                                                output_node))
        print("the number of input node is: {}, hidden node is: {}, output node is: {}\n".format(input_node, hidden_node,
                                                                                                output_node),
            file=output_file)
        print(" hidden node activation function is tanh function, output node activation function is sigmoid function")
        print(" hidden node activation function is tanh function, output node activation function is sigmoid function",
            file=output_file)

        # set to 4,4,3 is the best for the assignment 1 data
        # set to 11,58,3 is the best for 400 data assignment 2
        print("Start the training phase\n")
        print("Start the training phase\n", file=output_file)
        b1 = Bp.Backpro(input_node, hidden_node, output_node, d_final, d.get_x(),
                        learning_rate, file=output_file)  # first:weights,second:desire output
        b1.run(epsilon, epoch, error_criteria, momentum)
        print("Start the testing phase\n")
        print("Start the testing phase\n", file=output_file)
        true = b1.test(d.get_test_new(), epsilon)
        desire = Fn.test(d.get_test_desire(), epsilon)
        print('final Training epoch is: {}\n'.format(b1.get_epoch()))
        print('final Training epoch is: {}\n'.format(b1.get_epoch()), file=output_file)
        print('final Training Sum error is: {}\n'.format(b1.get_error()))
        print('final Training Sum error is: {}\n'.format(b1.get_error()), file=output_file)
        print('final Training Mean squared error is: {}\n'.format((1 / len(d_final)) * b1.get_error()))
        print('final Training Mean squared error is: {}\n'.format((1 / len(d_final)) * b1.get_error()), file=output_file)
        Fn.final(d.get_final_class(), desire, true, b1.get_error(), output_file, d_final)
        print('final Training epoch is: {}\n'.format(b1.get_epoch()))
        print('final Training epoch is: {}\n'.format(b1.get_epoch()), file=output_file)
    except IOError:
        print('File Error')
    finally:
        output_file.close()
예제 #3
0
파일: Main.py 프로젝트: Null78/XOnline
    def lose(self):
        import Final

        self.Form = Final.MyDialog()
        self.fui = Final.Ui_Dialog()
        self.fui.setupUi(self.Form)
        self.fui.Exit.clicked.connect(self.out)
        self.fui.Rematch.clicked.connect(self.rematch)
        self.Form.exec()
예제 #4
0
파일: Main.py 프로젝트: Null78/XOnline
    def draw(self):
        import Final

        self.Form = Final.MyDialog()
        self.fui = Final.Ui_Dialog()
        self.fui.setupUi(self.Form)
        self.fui.Exit.clicked.connect(self.out)
        self.fui.label.setPixmap(QPixmap(".\\img/draw.png"))
        self.fui.Rematch.clicked.connect(self.rematch)
        self.Form.exec()
예제 #5
0
def cross_validate(n):
    accuracy_list = []
    df = tt.preProcess()
    for i in range(n):
        X_train, X_test = train_test_split(df, test_size=0.1)
        dict, temp, classDict = tt.train_supervised(X_train)
        accuracy = tt.predict_supervised(dict, X_test, classDict)
        accuracy_list.append(accuracy)
    mean_accuracy = np.mean(accuracy_list)
    print("mean accuracy is: ", mean_accuracy)
    return np.mean(accuracy_list)
def upload():

    target = os.path.join(APP_ROOT, "static/")
    print(target)

    if not os.path.isdir(target):
        os.mkdir(target)

    for file in request.files.getlist("file"):
        print(file)
        filename = file.filename
        destination = "".join([target, filename])
        print(destination)
        #os.remove(r".\static\segmented.jpg")
        file.save(destination)

        inferencecopy2.DeeplabSeg(Image.open(destination))
        classpredic = Final.LdaAnalysis(Image.open(r'.\static\segmented.jpg'))

        #os.remove("segmented.jpg")

    return render_template("complete.html",
                           image_name1='segmented.jpg',
                           image_name2=filename,
                           value=classpredic)
예제 #7
0
    def buttonClicked(self):
      
        sender = self.sender()
        if sender.text() == "Show Basic":
            Final.show_regular(GenreList)
	if sender.text() == "Show Google":
            googlemap.show_google(GenreList)
	if sender.text() == "Show Location":
            if len(GenreList) == 1:
		self.statusBar().showMessage('')            	
		location.show_location(GenreList[0])
	    else:
		self.statusBar().showMessage('Only Accept One Input!')	
	if sender.text() == "Show Density":
            if len(GenreList) == 1:
		self.statusBar().showMessage('')
            	density.show_density(GenreList[0])
	    else:
		self.statusBar().showMessage('Only Accept One Input!')
예제 #8
0
def somefunc(link):
    http=urllib3.PoolManager()
    req=http.request('GET',link)
    soup=BeautifulSoup(req.data,'html.parser')
    #print("Step 1\n")
    f=open('Review.txt','a')
    global no
    global r1
    #print('number =')
    #print(no)
    r1.append(rank())
    for e in soup.find_all('h1'):
        h1=e.get('class')
        if h1 is not None and 'heading_title' in h1:
            f.writelines("******************************************")
            f.writelines(e.text)
            r1[no].name=e.text
            f.writelines("******************************************")
            f.writelines("\n\n")
    e1=soup.find_all("div",{"class":"entry"})
    sum=0
    for e in e1[1:10]:
        #if e.text is not None in e:
        h=e.text
        try:
            f.writelines(e.text)
            num=Final.rate(e.text)
            f.writelines('\n\n')
            print(e.text)
            if num > 3:
                f.writelines("Excellent Review: ")
                print("Excellent Review: ")
            elif num > 1:
                f.writelines("Good Review: ")
                print("Good Review: ")
            elif num < 0:
                f.writelines("Bad Review: ")
                print("Bad Review:")
            else:
                f.writelines("Average Review: ")
                print("Average Review: ")
            f.writelines(str(num))
            print(num)
            sum=sum+num
            f.writelines('\n\n\n')
        except:
            print('some Error')

    #print(sum)
    #print(no)
    r1[no].rate=sum
    f.close()
    no=no+1
예제 #9
0
def predict():
    clf = joblib.load('finalModel.pkl')
    to_predict_list = request.form.to_dict()
    card_id = request.form.getlist('card_id')
    date = pd.to_datetime(request.form['firstactivemonth'], errors='coerce')
    f1 = request.form.getlist('feature_1')
    f2 = request.form.getlist('feature_2')
    f3 = request.form.getlist('feature_3')
    data = {
        'card_id': card_id,
        'first_active_month': date,
        'feature_1': f1,
        'feature_2': f2,
        'feature_3': f3
    }
    data = pd.DataFrame(data)
    prediction = final.final_fun_1(data)
    print("Loyalty Score", prediction)
    return jsonify({'prediction': str(prediction)})
예제 #10
0
def ShelfLocation(shelf):
    shelf3 = Final.shelf()
    shelf2 = Final.shelf()
    shelf1 = Final.shelf()
예제 #11
0
import readFile
import Final

#Creates aisle
aisle1 = Final.Aisle()
aisle2 = Final.Aisle()
aisle3 = Final.Aisle()
aisle4 = Final.Aisle()
aisle5 = Final.Aisle()
aisle6 = Final.Aisle()


def ShelfLocation(shelf):
    shelf3 = Final.shelf()
    shelf2 = Final.shelf()
    shelf1 = Final.shelf()


#b =binLocation(readFile.binNum[0],readFile.descript[0])
#
def binLocation(binNumber, productList):
    if binNumber == 1:
        bin1 = Final.Bin(productList)
        return print(bin1)
    if binNumber == 2:
        bin2 = Final.Bin(productList)
        return print(bin2)
    if binNumber == 3:
        bin3 = Final.Bin(productList)
        return bin3
    if binNumber == 4:
예제 #12
0
파일: run.py 프로젝트: alon/antmeeting
 def make_grid(self, board_size):
     return Final.make_grid(list(board_size))
예제 #13
0
파일: run.py 프로젝트: alon/antmeeting
 def make_ants(self, ant_locations):
     return Final.make_ants(tuple(map(tuple,ant_locations)))
import Final
import cv2

ls = {}  # required dictionary
while (1):
    val = Final.GetValues(ls)
    print(ls)
    if val == 27:  #press esc to break the loop
        break

cv2.destroyAllWindows()
예제 #15
0
def adding():
    Final.add_person("face_recognition_system/people/", "rectangle",
                     person1.get())
예제 #16
0
def attendance():
    Final.recognize_people("face_recognition_system/people/", "rectangle")
예제 #17
0
from Start import *
from Final import *
from Game import *

a = Start()
a.blank()
b = Game()
b.window(int(a.start_count), int(a.start_money))

c = Final()

name = b.zn[0]
money = b.mon_all[4]
x = list(zip(name, money))
x.sort(key=lambda f: f[1])
x.reverse()

name = [i[0] for i in x]  #список имен с капиталом по убыванию
money = [i[1] for i in x]  #список капиталов по убыванию
c.window(name, money, b.mon_all)
print(c.mnoey)