IBM / taxinomitis

Source code for Machine Learning for Kids site
https://machinelearningforkids.co.uk
Apache License 2.0
138 stars 133 forks source link

Can't use my numbers model #494

Closed GuillLambert closed 3 months ago

GuillLambert commented 3 months ago

Hello,

I'm using the model numbers "Noughts and crosses". But i can't train. See the errors message that is given me by Visual studio code đź‘Ť Tank you for your answer

PS C:\Users\LAMBERT> & "C:/Program Files/Python311/python.exe" d:/LYCEE/COURS/NSI/T_NSI/COURS_T_NSI/Travail_machine_learning/morpion_fichier_a_completer_test.py pygame 2.5.2 (SDL 2.28.3, Python 3.11.0) Hello from the pygame community. https://www.pygame.org/contribute.html {'error': 'Classification for this project is only available in the browser'} Traceback (most recent call last): File "d:\LYCEE\COURS\NSI\T_NSI\COURS_T_NSI\Travail_machine_learning\morpion_fichier_a_completer_test.py", line 640, in gameover = let_computer_play(screen, board) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\LYCEE\COURS\NSI\T_NSI\COURS_T_NSI\Travail_machine_learning\morpion_fichier_a_completer_test.py", line 577, in let_computer_play computer_move = classify(board) ^^^^^^^^^^^^^^^ File "d:\LYCEE\COURS\NSI\T_NSI\COURS_T_NSI\Travail_machine_learning\morpion_fichier_a_completer_test.py", line 131, in classify response.raise_for_status() File "C:\Users\LAMBERT\AppData\Roaming\Python\Python311\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://machinelearningforkids.co.uk/api/scratch/1bfffd60-edbc-11ee-9189-23f7be847bc1a040bee9-33de-4e65-b8c1-45f700bd415e/classify?data=OPPONENT&data=EMPTY&data=EMPTY&data=EMPTY&data=EMPTY&data=EMPTY&data=EMPTY&data=EMPTY&data=EMPTY PS C:\Users\LAMBERT>

dalelane commented 3 months ago

Sorry about this - I changed the way numbers models work last night and forgot about the sample code for Noughts and Crosses. That will need updating to match with the new approach to models.

For the full context, you can see https://dalelane.co.uk/blog/?p=5119

But the short answer is I used to keep the model in the cloud - so all classifying involved making an HTTP request to the Machine Learning for Kids server, and getting the classification back. Now, you download the model from the cloud, and do all the classifying on your own computer.

GuillLambert commented 3 months ago

Hello,

OK thanks for your answer. This means that for the moment we cannot use the site to train our model to play tic-tac-toe with the nacstudentsempty.py file as we did before? Do you know when the site will be updated? Let me explain, I wanted to host a session with my students on April 11th... If the site is not available, I will write another activity for my students.

Thanks for your feedback,

Guillaume LambertMessage ID: @.***>

dalelane commented 3 months ago

The nacstudentsempty.py file needs to be updated so that it classifies numbers locally such as shown here rather than making an HTTP POST to send the numbers to a server (as it currently does here).

It also needs to be updated to download the trained model from the server in the first place, as shown here.

Otherwise, the rest should work okay.

I will make those updates, but I can't guarantee I will make those updates to that Python code by April 11th - sorry, I'm on vacation with my family, and I've already spent more of it on my laptop than is really ideal!

GuillLambert commented 3 months ago

Thank you for your answer,

I look on what you've shown me to classify locally numbers, and i will update the file. Have nice holidays ! Guillaume Lambert

Le 06/04/24, Dale Lane @.***> a Ă©crit :

The nacstudentsempty.py file needs to be updated so that it classifies numbers locally such as shown here(https://github.com/IBM/taxinomitis/blob/master/resources/mlforkidsnumbers.py#L149-L188) rather than making an HTTP POST to send the numbers to a server.

I will make those updates, but I can't guarantee I will make those updates to that Python code by April 11th - sorry, I'm on vacation with my family, and I've already spent more of it on my laptop than is really ideal!

— Reply to this email directly, view it on GitHub(https://github.com/IBM/taxinomitis/issues/494#issuecomment-2041041650), or unsubscribe(https://github.com/notifications/unsubscribe-auth/BHTKZ7XVPTC7Z3F4OS3QNULY37EULAVCNFSM6AAAAABFYXJR3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGA2DCNRVGA). You are receiving this because you authored the thread.Message ID: @.***>

dalelane commented 3 months ago

@GuillLambert I've updated the sample code and worksheet to match the new type of numbers models

https://github.com/dalelane/Noughts-and-Crosses

https://github.com/IBM/taxinomitis-docs/blob/master/project-worksheets/pdf/worksheet-noughtsandcrosses-python.pdf

Sorry again for any hassle this caused

GuillLambert commented 3 months ago

Thank you so much ! I look on that.

Le 10/04/24, Dale Lane @.***> a Ă©crit :

@GuillLambert(https://github.com/GuillLambert) I've updated the sample code and worksheet to match the new type of numbers models

https://github.com/dalelane/Noughts-and-Crosses

https://github.com/IBM/taxinomitis-docs/blob/master/project-worksheets/pdf/worksheet-noughtsandcrosses-python.pdf

Sorry again for any hassle this caused

— Reply to this email directly, view it on GitHub(https://github.com/IBM/taxinomitis/issues/494#issuecomment-2046243364), or unsubscribe(https://github.com/notifications/unsubscribe-auth/BHTKZ7WDO3FLHFSDCSUKMALY4SBSNAVCNFSM6AAAAABFYXJR3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBWGI2DGMZWGQ). You are receiving this because you were mentioned.Message ID: @.***>