Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Member-only story

Elastic Net Regression: From Sklearn to Tensorflow

7 min readSep 23, 2022

--

Photo by Mike Cox on Unsplash

This article is intended for the practitioners who want to compare the sklearn and Keras implementation of elastic net regression. Mainly, how to go from Sklearn loss function to Keras (Tensorflow) loss function.

Main parts of the article:

  • A brief introduction to regularization in regression.
  • Sklearn implementation of the elastic net.
  • Tensorflow implementation of the elastic net.
  • Going from one framework to another.
  • Writing a custom loss function.
  • Comparing the results.

All the codes are in my repository: https://github.com/Eligijus112/regularization-python

Regression is a process in machine learning determining the relationship between the mean value of the response variable Y and features X.

The prediction for a model is denoted as y with a hat and is calculated by estimating the coefficients beta from data:

The betas without a hat denote the theoretical model and the betas with a hat denote the practical model, which was obtained…

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Eligijus Bujokas
Eligijus Bujokas

Written by Eligijus Bujokas

A person who tries to understand the world through data and equations