This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from wordcloud import WordCloud, ImageColorGenerator | |
| from PIL import Image | |
| from stop_words import get_stop_words | |
| stopwords = get_stop_words('es') | |
| mask = np.array(Image.open('img/logo/vox.png')) | |
| wc = WordCloud(background_color="white", max_words=300, mask=mask, | |
| width=900, height=450, min_font_size=7, max_font_size=100, | |
| stopwords=stopwords, collocations=True, normalize_plurals=True, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | px.bar( | |
| cis_df, x="concern", y="problem", template="plotly_white", | |
| labels=dict(concern="% of respondents for whom the problem is Top 3", problem="Problem"), | |
| width=970, height=800, title="Main (3) concerns of spanish people [March 2019]", | |
| orientation='h' | |
| ) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | plt.figure(figsize=(8,11)) | |
| ax = sns.heatmap(df.T, annot=True, fmt='d', cmap='Blues', cbar=False, linecolor='white', linewidths=2) | |
| ax.tick_params(labelbottom=True, labeltop=True, labelsize=13, labelcolor='black') | |
| ax.set_title('\nOccurrences of topic-related key words on each electoral program\n\n', | |
| fontsize=16); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ax = sns.heatmap(df_rel.T.round(3), annot=True, fmt='g', cmap='Blues', linecolor='white', linewidths=1) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ax = df_rel.T.plot(kind='barh', figsize=(11,30), fontsize=13) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | data = ImageDataBunch.from_df( | |
| df=df_styles, path=pictures_dir, label_col='style', fn_col='new_filename', | |
| ds_tfms=get_transforms(), size=299, bs=48).normalize(imagenet_stats) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | learner = cnn_learner(data, models.resnet50, metrics=[error_rate]) | |
| learner.fit_one_cycle(6) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | learner.lr_find() | |
| learner.recorder.plot() | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | learner.unfreeze() | |
| learner.fit_one_cycle(7, max_lr=slice(1e-6,3e-4)) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | img = open_image('data/the_scream.jpg') | |
| pred = learner.predict(img); pred |