 # bluatigro

Eurobricks Vassals

22

• #### Last visited • Birthday 01/06/1960

## Spam Prevention

• What is favorite LEGO theme? (we need this info to prevent spam)
mindstorms

## Profile Information

• Gender
Male
• Location
• Interests
creating a.i. animation games robot's
esperanto

• Country
netherlands

## Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. the IDE complains over the rem's it is translated from c++ throu basic i can not test this let me know if you got it working ''' bluatigro 14 nov 2021 ann try based on : http://code.activestate.com/recipes/578148-simple-back-propagation-neural-network-in-python-s/ ''' import random , math # consts NI = 2 # number of inputs NH = 2 # number of hidden cels NO = 1 # number of outputs # cels ai = list() for i in range( NI ) : ai.append( 0.0 ) ah = list() for h in range( NH ) : ah.append( 0.0 ) ao = list() for o in range( NO ) : ao.append( 0.0 ) # wished output wish = list() for w in range( NO ) : wish.append( 0.0 ) # weights wih = list() ci = list() for i in range( NI ) : wih[ i ] = list() ci[ i ] = list() for h in range( NH ) : wih[ i ].append( random.random() ) ci[ i ].append( random.random() ) who = list() co = list() for h in range( NH ) : who[ h ] = list() co( h ) = list() for o in range( NO ) : who[ h ].append( random.random() ) co[ h ].append( random.random() ) od = list() hd = list() for h in range( NH ) : od.append( random.random() ) hd.append( random.random() ) # input output training data : XOR function paterns = 4 pin = {{0.0,0.0},{1.0,0.0},{0.0,1.0},{1.0,1.0}} pout = { 0.0 , 1.0 , 1.0 , 0.0 } def tanh( x ) : return ( 1 - math.exp( -2 * x ) ) \ / ( 1 + math.exp( -2 *x ) ) def dsignoid( x ) : return 1 - x * x def calc( p ) : for i in range( NI ) : ai[ i ] = pin[ i ][ p ] for h in range( NH ) : som = 0.0 for i in range( NI ) : som += ai[ i ] * wih[ i ][ h ] ah[ h ] = tanh( som / NI ) for o in range( NO ) : som = 0.0 for h in range( NH ) : som += ah[ h ] * who[ h ][ o ] ao[ o ] = tanh( som / NH ) def backprop( n , m ) : ''' http://www.youtube.com/watch?v=aVId8KMsdUU&feature=BFa&list=LLldMCkmXl4j9_v0HeKdNcRA calc output deltas we want to find the instantaneous rate of change of ( error with respect to weight from node j to node k) output_delta is defined as an attribute of each ouput node. It is not the final rate we need. To get the final rate we must multiply the delta by the activation of the hidden layer node in question. This multiplication is done according to the chain rule as we are taking the derivative of the activation function of the ouput node. dE/dw[j][k] = (t[k] - ao[k]) * s'( SUM( w[j][k]*ah[j] ) ) * ah[j] ''' totfout = 0 for k in range( NO ) : totfout += math.abs( ao( k ) - wish( k ) ) # update output weights for j in range( NH ) : for k in range( NO ) # output_deltas[k] * self.ah[j] # is the full derivative of # dError/dweight[j][k] c = od[ k ] * ah[ j ] wo[ j ][ k ] += n * c + m * co[ j ][ k ] co[ j ][ k ] = c # calc hidden deltas for j in range( NH ) : fout = 0 for k in range( NO ) : fout += od[ k ] * wo[ j ][ k ) hd[ j ] = fout * dsignoid( ah[ j ] ) # update input weights for i in range( NI ) : for j in range( NH ) : c = hd[ j ] * ai[ i ] wi[ i ][ j ] += n * c + m * ci[ i ][ j ] ci[ i ][ j ] = c return totfout / 2 for e in range( 10000 ) : fout = 0 # fill input cel's for p in range( paterns ) : for i in range( NH ) : ai[ i ] = pin[ i ][ p ] # fill output wish for o in range( NO ) : wish[ o ] = pout[ p ] fout += backprop( .5 , .5 ) print( 'generatie ' , e , ' error ' , fout )
2. i want to know whitch is better a mobile or a other remote control whitc are there ? pro and cons ?
3. hello legofans i fount a playlist on youtube type : python for 51515 and you can see some python for 51515 greatings
4. i can not find the to python button and the book button
5. @lok24 : thanks for the 'book' sugestion i wil look into that
6. #create objects dist = DistanceSensor( 'E' ) color = ColorSensor( 'F' ) #read examples darkness = color.get_reflected_light() color.wait_for_color( 'red') dist.wait_for_distance_closer_then( 10 , 'cm' ) hub.moition_sensor.wait_for_new_gesture( 'tapped' )
7. hub = MSHub() mp = MotorPair( 'A' , 'B' ) mp.set_default_spped( 50 ) mp.move( 2 , "rotations' , steering = 0 ) #roations can also be degrees or seconds
8. i fond the folowing site about python for 51515 : LEGO Mindstorms 51515 Micropython tutorial : mindstorms (reddit.com) but i can not use it because of little char's
9. i m looking for the translation from scratch into python of the lego specific comands python i do know partly now if you help me whit lego-python i wil post advanced python code i have a code for neural network whit 1 hidden layer in native python [ for example ] i do not know every thing of python but i know OOP in it i know that you can translate scratch code lines into python but i do not know jet how to do that in the IDEapp i m a member of hcc AI groop
10. on my new pc it went good on my old pc i needed a drive account [ \$9.99] so i did not do that [ i do not have a credidcard ] so i wil onlky use my new pc for the 51515 are there python examples for 51515 on the web ? whit python i can enlarge the char's in the ide
11. has the central hub of the 51515 a usb port ? i do not want to use bluetooth
12. i wood like to have a script language in ev3 mindstorms ide whit [ at least ] : loops , choises , recursion , arrays , subs , functions , file i/o [ on brick ] , include and random OOP wil be nice but is not nessesery i don't care whitch language i m a c++ , python and basic programmer [ i don't get payed ] [ basic i do from 1988 so that has my biggest suport ]
13. i had some wadering done on www en fond www.makecode.org this is a site whit several mirco controlers controled by a kind of scratch you can also program in javasrcipt i made the folowing js code [ not tested jet ] let move = "wait"; sensors.remoteButtonTopLeft.onEvent(ButtonEvent.Pressed, function () { move = "turn left" }) sensors.remoteButtonTopRight.onEvent(ButtonEvent.Pressed, function () { move = "forwart" }) sensors.remoteButtonBottomLeft.onEvent(ButtonEvent.Pressed, function () { move = "turn right" }) sensors.remoteButtonBottomRight.onEvent(ButtonEvent.Pressed, function () { move = "backwart" }) motors.stopAll() forever(function () { switch (move) { case "turn left": motors.largeBC.tank(-50, 50) break case "forwart": motors.largeBC.tank(50, 50) break case "turn right": motors.largeBC.tank(50, -50) break case "backwart": motors.largeBC.tank(-50, -50) break default: motors.stopAll() break } control.waitMicros(100) move = "wait" })
14. i m planning a mecrano weeled robot the robot wil be smaller that the one you are oplanning the [ remote ] control program in ev3-g is al ready but not tested