How to use establecer_atributos method in SeleniumBase

Best Python code snippet using SeleniumBase

individuo.py

Source:individuo.py Github

copy

Full Screen

...64 self.contador_interacciones += 165 if a.salud == self.model.SUSCEPTIBLE and\66 self.model.rand.random() < self.prob_contagiar:67 a.salud = self.model.EXPUESTO68 def establecer_atributos(self, attrs):69 """70 Asigna los atributos que se encuentran en attrs al agente.71 Aunque no pertenezca nativamente al agente, este es agregado.72 """73 for at in attrs:74 try:75 getattr(self, at)76 except AttributeError:77 print(f'El atributo {at} no es nativo del agente')78 setattr(self, at, attrs[at])79#-----------------------------------------------------------------------------80class Individuo_2(Individuo_base):81 82 def __init__(self, unique_id, model):83 super().__init__(unique_id, model)84 self.nodo_casa = None85 self.tray_nodos = list()86 ##Atributos de comportamiento87 self.evitar_sintomaticos = False88 self.distancia_paso = 189 self.frac_mov_nodos = 0.1 #porcentaje de movimiento con respecto al movimiento total90 91 def step(self):92 dia = self.model.dia93 momento = self.model.n_paso%self.model.pp_dia94 fecha = (self.model.dia_cero + self.model.un_dia*dia).strftime('%Y-%m-%d')95 96 try:97 prob_mov= (1+self.model.movilidad.loc[fecha]/100)*self.prob_movimiento98 except:99 prob_mov= self.prob_movimiento100 if momento<2:101 disponibles = list(self.mundo.successors(self.nodo_actual))102 nuevo_nodo = self.model.rand.choice(disponibles)103 prob_mov_nodos = self.mundo.obtener_peso(self.nodo_actual, nuevo_nodo)*prob_mov104 if self.model.rand.random()<prob_mov:105 if self.model.rand.random()<prob_mov_nodos:106 if nuevo_nodo == self.nodo_casa:107 self.tray_nodos = []108 else:109 self.tray_nodos.append(nuevo_nodo)110 self.mundo.mover_en_nodos(self, nuevo_nodo)111 else:112 self.mundo.siguiente_paso_aleatorio(self, 113 evitar_agentes=self.evitar_agentes,114 evitar_sintomaticos=self.evitar_sintomaticos,115 radio = self.distancia_paso)116 elif momento>1:117 regresar = self.nodo_actual != self.nodo_casa118 if regresar:119 if len(self.tray_nodos)>0:120 self.tray_nodos.pop()121 nuevo_nodo = self.tray_nodos[-1] if len(self.tray_nodos)>0\122 else self.nodo_casa123 self.mundo.mover_en_nodos(self, nuevo_nodo)124 else:125 self.mundo.siguiente_paso_aleatorio(self, 126 evitar_agentes=self.evitar_agentes,127 evitar_sintomaticos=self.evitar_sintomaticos,128 radio = self.distancia_paso)129 self.interactuar()130 131 ## Se revisa la evolución de su salud132 if self.salud == self.model.EXPUESTO:133 self.pp_infectarse -= 1134 infectarse = self.pp_infectarse == 0 and self.model.rand.random()<self.prob_infectarse135 if infectarse:136 self.salud = self.model.INFECTADO137 elif self.pp_infectarse == 0:138 self.salud = self.model.SUSCEPTIBLE139 self.pp_infectarse = int(self.model.rand.gauss(self.dp_infectar,140 self.dp_infectar_var/2))*self.model.pp_dia141 elif self.salud == self.model.INFECTADO:142 self.pp_recuperarse -= 1143 if self.pp_recuperarse == 0:144 self.salud = self.model.RECUPERADO145 146 147 def aplicar_medidas(self, medidas = {}):...

Full Screen

Full Screen

id3.py

Source:id3.py Github

copy

Full Screen

...5 self.raiz = None6 self.atributos = None7 def crear_nodo(self, nombre, padre, arista=None):8 return Nodo(nombre, padre, arista)9 def establecer_atributos(self, atributos):10 self.atributos = atributos11 def instancia_mas_abundante(self, Y):12 unicos, cuenta = np.unique(Y, return_counts=True)13 cuenta = cuenta.tolist()14 return unicos[cuenta.index(max(cuenta))]15 def entrenar(self, X, Y):16 # Establecemos etiquetas por defecto.17 if self.atributos is None:18 self.atributos = [str(x) for x in range(X.shape[1])]19 # Nos fijamos si solo existe una clase.20 if np.all(Y == Y[0]):21 self.raiz = self.crear_nodo(Y[0], None)22 23 # De lo contrario buscamos el nodo raíz....

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeleniumBase automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful