This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.

# Towards Better Keras Modeling – Part VI

See the previous installment in this series to learn about Univariate Relationships.

### Multivariate Effects

Of course, reality is non-linear and we can’t think about each of these parameters in isolation. Below are a few ways to look at pairs of factors that are logically related.

df_grid = df.reset_index().groupby([“first_neuron”, “hidden_neuron”]).val_loss_improvement.mean().unstack()
ax = sns.heatmap(data=df_grid,cmap = (sns.diverging_palette(10, 220, sep=80, n=7)),annot=True)
ax.set_title(‘Log-Loss Improvement for Varying Shapes’)

# Unsurprisingly, bigger on both layer types is better.

df_grid = df.reset_index().groupby([“hidden_layers”, “hidden_neuron”]).val_loss_improvement.mean().unstack()
ax = sns.heatmap(data=df_grid,cmap = (sns.diverging_palette(10, 220, sep=80, n=7)),annot=True)
ax.set_title(‘Log-Loss Improvement for Varying Shapes’)

df_grid = df.reset_index().groupby([“dropout”, “hidden_neuron”]).val_loss_improvement.mean().unstack()
ax = sns.heatmap(data=df_grid,cmap = (sns.diverging_palette(10, 220, sep=80, n=7)),annot=True)
ax.set_title(‘Log-Loss Improvement vs Dropout/Size’)

# Surprisingly, dropout didn’t help even at larger geometries

metric = ‘hidden_layers’
ax = sns.boxplot(x=metric, y=”val_loss”, data=df.reset_index(),color=’salmon’)
ax.set_title(f’Validation Loss as function of {metric}’)

# Very interestingly, no hidden layers is MUCH better. Possibly a consequence of
# some deep models with too few neurons to properly represent data

Stay tuned for the next installment in this series to learn more about Relative Importance of Features.

Visit The Alpha Scientist blog to download the complete code:
https://alphascientist.com/hyperparameter_optimization_with_talos.html

The Alpha Scientist blog – Chad is a full-time quantitative trader who has been working on data analytics since before it was cool. He has long balanced his interest in computer science (MS in EE/CS from MIT) with a fascination in markets (CFA designation in 2009). Prior to becoming a full-time quant, he built analytics products and managed teams at software companies across Silicon Valley. If you’ve found this post useful, please follow @data2alpha on Twitter and forward to a friend or colleague who may also find this topic interesting. https://alphascientist.com/

##### Disclosure: Interactive Brokers

Information posted on IBKR Traders’ Insight that is provided by third-parties and not by Interactive Brokers does NOT constitute a recommendation by Interactive Brokers that you should contract for the services of that third party. Third-party participants who contribute to IBKR Traders’ Insight are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from The Alpha Scientist and is being posted with permission from The Alpha Scientist. The views expressed in this material are solely those of the author and/or The Alpha Scientist and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.