-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBioIA.py
More file actions
52 lines (39 loc) · 972 Bytes
/
Copy pathBioIA.py
File metadata and controls
52 lines (39 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 23 19:07:26 2019
@author: remi
"""
import numpy as np
def check(garage,IA,voiture):
resultat=np.sum(garage.dot(IA))
print(resultat)
if resultat < 0.33 :
porte = 1
elif resultat < 0.66 :
porte = 2
else :
porte = 3
print(porte)
return(porte==voiture)
garage = [ np.array([1,0,0]), np.array([0,1,0]), np.array([0,0,1]) ]
voiture= [ 1 ,2 , 3]
groupe=list()
for i in range(1000) :
groupe.append( np.random.rand(3,1) )
test=list()
for IA in groupe :
checking= check(garage[0],IA,voiture[0]) + check(garage[1],IA,voiture[1]) + check(garage[2],IA,voiture[2])
if checking >2 :
test.append((IA,True ))
else :
test.append((IA,False ))
count=0
gagnants=list()
for output in test:
if output[1]==True:
count+=1
gagnants.append(output[0])
"""
solution=np.array([ [0.3] , [0.6] , [0.9] ])
"""