Word Embedding Castellano:
import tensorflow as tf tf.config.list_physical_devices()
from tensorflow.python.client import device_lib device_lib.list_local_devices()
device=device_lib.list_local_devices()[0] with tf.device(device.name): history=model.fit(x, y,epochs=epochs,verbose=False)
poetry config virtualenvs.in-project true poetry config --list #se debe instalar siempre esta dependencia poetry add ipykernel #instalar poetry install #ejecutar código python poetry run python my_script.py
from matplotlib.colors import LinearSegmentedColormap, to_rgb def crear_colomap_continuo(hex_colors): all_red = [] all_green = [] all_blue = [] for hex_color in hex_colors: all_red.append(to_rgb(hex_color)[0]) all_green.append(to_rgb(hex_color)[1]) all_blue.append(to_rgb(hex_color)[2]) num_colors = len(hex_colors) - 1 red = tuple([(1/num_colors*i,v,v) for i,v in enumerate(all_red)]) green = tuple([(1/num_colors*i,v,v) for i,v in enumerate(all_green)]) blue = tuple([(1/num_colors*i,v,v) for i,v in enumerate(all_blue)]) color_dictionary = {'red':red,'green':green,'blue':blue} new_cmap = LinearSegmentedColormap('new_cmap',segmentdata=color_dictionary) return new_cmap new_cmap = build_custom_continuous_cmap(["#FFFFFF","#DBE6FA","#C3D6F4","#ACC8EF","#96BBE9","#81AFE4","#6DA4DE","#599BD9","#4793D3","#358CCE","#2486C8","#1481C3","#057DBD"])