Image for post
Image for post

Knowing that a customer is going to bring a certain amount of money for the company early enough can be very helpful to know how much the company can spend to retain it.
Indeed, if a customer only brought in € 10 during his life as a customer in the company, we will not spend more than € 10 to retain him.

There are many techniques out there for estimating Customer Lifetime Value and we are going to introduce you two of them that will allow you to estimate its value without waiting to have a significant purchase history.

The…


In this post, we will learn how create a contact form using Flask. The result will be like this :

Image for post
Image for post

I. Build Contact Form

All script are available on: https://github.com/Faouzizi/flaskCreateContactForms

First of all you need to install flask and flask_wtf using pip : pip install flask flask_wtf.

a. Create our html contact page

Here we will add all fields that we want to retrieve.

<!-- here we add our contact forms -->
{% block content %}
<div class="contact">
<h3>Contact us</h3>
<!-- Just here i use "url_for" to call the function get_contact. This function return the html code of our contact page--> <form action="{{ url_for('get_contact')…


Image for post
Image for post

Here’s a complete tutorial to learn how we can create a responsive navigation bar, that adapt their layouts to the viewport size, using Flask from scratch.

In this tutorial, we’ll look into how use Bootstrap to create a responsive NavBar on Flask. Our navigation will have three different layouts, depending on the viewport size:

  1. a mobile layout in which only the logo and a toggle button will be visible by default and users can open and close the menu using the toggle,
  2. a tablet layout in which we will show two call-to-action buttons between the logo and toggle in the…


Image for post
Image for post
By Emily Morter on Unsplash

If you are starting your life as a data scientist, you will hear around you things like why we didn’t get the expected performance? This model is a failure!
We must find a solution to improve this model or We must start from the beginning.

If you want to avoid to be in this kind of situation, you must avoid some beginner mistakes. Here, we will discuss some of them that we already have committed and you can avoid.

  1. Understand The Client Need

Understanding the need and not what your are being asked to achieve is essential.

The client or…


Allow users to connect to their personal space is one of the most important feature for you web application. In this article, i will explain you how you can add an authentication by adding a login page using the Flask-Login python package.

All script are available on my GitHub here.

Image for post
Image for post
Login Page Flask Example

So here, we will create a sign up, sign in and login out pages that will allow users to connect to their personnal private spaces that if they are not connected they can’t see them. …


Image for post
Image for post
High Cardinality

When you staring a machine learning or a data science project, you begin your explanatory analysis to extract interesting informations.
One of the most common problem that we encounter is high cardinality on qualitative variables (too many unique values).
This effect will introduce instability in your model.

So how can we treat high cardinality ?
Common solutions are :

  • Label Encoder : Replace string values by integer classes [0, 1, 2, 3…]
  • Dummy Encoder : This method consist on creating n new variables of
    {0, 1}. This method is not very practical and processing time will significantly increase.
  • Aggregating Values…


Image for post
Image for post

Missing values and outliers are frequently encountered when dealing with data. So the big question in this kind of case is how to treat these missing or outliers values?

In this article, we will present you with some methods to identify and treat missing values as well as outliers.

For this article, we will use this data: https://www.kaggle.com/gregorut/videogamesales

Univariate analysis

To start any data project, you need to know the data you have. Are there missing values? What about Outliers? Some variables have too many values and will introduce instability on your model? …

So univariate analysis can answer all these questions…


Image for post
Image for post
RFM Analysis : Recency, Frequency and monetary Value

All companies have more and more customer data based on behaviors and simple but powerfull way to categorize this clients is RFM segmentation.
The RFM segmentation is a solution for split our customers on segments(clusters) according to their behavior like recency, frequency and the monetary value.

The RFM segmentation will allow us:

  • Drive customer segmentation strategy
  • Trigger automated marketing campaigns
  • Build smarter remarketing campaigns

The goal for this method is to categorize our customers on segments using three variables Recency, Frequency and Monetary value (hence the name RFM).

Today, the RFM model is used by digital marketers to send relevant…


Image for post
Image for post
Docker containers, Python, Flask Machine Learning

After reading this article you will be able to build your entire project on Docker.
Docker is an open source platform for developing apps that enable separate your applications from your infrastructure.
The aim of this is quickly delivering software.

So the first step to dockerize your project begin with installing Docker.

I. Install Docker

On desktop

  • For macOs
    Just download the dmg programme there and double click on it then drag the Docker icon to Applications folder.
    Requirements are :
    - Mac hardware must be a 2010 or a newer model with an Intel processor
    - macOS must be version 10.14 …


The aim of this article is to explain how we can use our personnal or professional e-mail address to automate and schedule sending e-mails using python.

I. Create and send e-mail using python

First Step : Import python packages

####################################################################
############# Import packages
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# to create html template for the email content
from string import Template
# if we want include images
import base64

Second step : Create the email content

Create your email template using html and css :

####################################################################
############# Build the email content using html
##################################################################### Import image
img_uri = base64.b64encode(open('path/img.png', 'rb').
read()).decode('utf-8') …

Elfao

Data scientist with 4 years experience.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store