houda lahlouKenzi Sarra
Published © GPL3+

Polytech's Energy Monitoring System

Measure, monitor and predict energy consumption

IntermediateFull instructions providedOver 1 day16
Polytech's Energy Monitoring System

Things used in this project

Hardware components

Grove - Electricity Sensor
Seeed Grove - Electricity Sensor
×1
The Things Uno
The Things Network The Things Uno
×1
LoRa LoRaWAN Gateway
Seeed LoRa LoRaWAN Gateway
×1

Software apps and online services

The Things Network
The Things Network
Anaconda
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Wiring schema

Code

Puissance

Arduino
Read, process and send data to the gateway
#include <TheThingsNetwork.h>
#include <CayenneLPP.h>

// Set your AppEUI and AppKey
const char *appEui = "70B3D57ED002A483";
const char *appKey = "C6FE88C86D54E5EB145529E0B47301E5";

#define loraSerial Serial1
#define debugSerial Serial

// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_EU868

TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
CayenneLPP lpp(51);


// Variables globales pour stocker les anciennes valeurs

int valeur1 = 0;
int valeur2 = 0;
int valeur3 = 0;

//Variable global pour grer le dlai d'envoi des donnes
int compteur=0;


void setup()
{
  loraSerial.begin(57600);
  debugSerial.begin(9600);

  // Wait a maximum of 10s for Serial Monitor
  while (!debugSerial && millis() < 10000)
    ;

  debugSerial.println("-- STATUS");
  ttn.showStatus();

  debugSerial.println("-- JOIN");
  ttn.join(appEui, appKey);
}

void loop()
{
TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
CayenneLPP lpp(51);

  int valeur11 = analogRead(A0);
  int valeur21 = analogRead(A1);
  int valeur31 = analogRead(A2);

  
  valeur1 = max(valeur11,valeur1);
  valeur2 = max(valeur21,valeur2);
  valeur3 = max(valeur31,valeur3);

  compteur += 1;

// 1s = 1000ms
if(compteur == 1000) {

  float courant1 = valeur1 *30.3* (5.0 / 1023.0) * sqrt(2);  //30.3 (pour100A on a 3.3 V )
  
  float courant2 = valeur2 * 30.3 * (5.0 / 1023.0) * sqrt(2) ; //racine de deux *valeur efficace du courant ( signal sinus) =Imax
  
  float courant3 = valeur3 * 30.3 *(5.0 / 1023.0) * sqrt(2) ;

  float puissance1 = 240* (courant1);
  float puissance2 = 240* (courant2);
  float puissance3 = 240* (courant3);
  float puissance4 = puissance1+puissance2+puissance3;

  lpp.addAnalogInput(4,puissance4);
  
  
//Send it off
 ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
  compteur = 0;
 
  valeur1 = 0;
  valeur2 = 0;
  valeur3 = 0;
}
  

  delay(1);
}

Power Prediction

Python
Build a Machine Learning Model that prdict Power consumption
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Importation des librairies"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import linear_model\n",
    "import warnings\n",
    "warnings.filterwarnings('ignore')\n",
    "warnings.simplefilter('ignore')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Importation des donnes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv(\"../Puissance.csv\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Analyse des donnes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateHeure</th>\n",
       "      <th>Puissance</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>01/04/2020 13:01:29</td>\n",
       "      <td>1562.445517</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>01/04/2020 13:31:29</td>\n",
       "      <td>2181.738667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>01/04/2020 14:01:29</td>\n",
       "      <td>2752.225827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>01/04/2020 14:31:29</td>\n",
       "      <td>2003.979045</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>01/04/2020 15:01:29</td>\n",
       "      <td>2348.234105</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             DateHeure    Puissance\n",
       "0  01/04/2020 13:01:29  1562.445517\n",
       "1  01/04/2020 13:31:29  2181.738667\n",
       "2  01/04/2020 14:01:29  2752.225827\n",
       "3  01/04/2020 14:31:29  2003.979045\n",
       "4  01/04/2020 15:01:29  2348.234105"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(10000, 2)"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['DateHeure'] = pd.to_datetime(data['DateHeure'], dayfirst = True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DateHeure    datetime64[ns]\n",
       "Puissance           float64\n",
       "dtype: object"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateHeure</th>\n",
       "      <th>Puissance</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>10000</td>\n",
       "      <td>10000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>unique</th>\n",
       "      <td>10000</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>top</th>\n",
       "      <td>2020-06-07 05:31:29</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>freq</th>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>first</th>\n",
       "      <td>2020-04-01 13:01:29</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>last</th>\n",
       "      <td>2020-10-26 20:31:29</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>NaN</td>\n",
       "      <td>592.929413</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>NaN</td>\n",
       "      <td>884.358110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>NaN</td>\n",
       "      <td>100.022437</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>NaN</td>\n",
       "      <td>131.662871</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>NaN</td>\n",
       "      <td>163.118110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>NaN</td>\n",
       "      <td>194.904384</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>NaN</td>\n",
       "      <td>2998.318641</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  DateHeure     Puissance\n",
       "count                 10000  10000.000000\n",
       "unique                10000           NaN\n",
       "top     2020-06-07 05:31:29           NaN\n",
       "freq                      1           NaN\n",
       "first   2020-04-01 13:01:29           NaN\n",
       "last    2020-10-26 20:31:29           NaN\n",
       "mean                    NaN    592.929413\n",
       "std                     NaN    884.358110\n",
       "min                     NaN    100.022437\n",
       "25%                     NaN    131.662871\n",
       "50%                     NaN    163.118110\n",
       "75%                     NaN    194.904384\n",
       "max                     NaN   2998.318641"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.describe(include='all')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Enrichissement des donnes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Jour'] = data['DateHeure'].dt.day\n",
    "data['Heure'] = data['DateHeure'].dt.hour\n",
    "data['Mois'] = data['DateHeure'].dt.month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateHeure</th>\n",
       "      <th>Puissance</th>\n",
       "      <th>Jour</th>\n",
       "      <th>Heure</th>\n",
       "      <th>Mois</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-04-01 13:01:29</td>\n",
       "      <td>1562.445517</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2020-04-01 13:31:29</td>\n",
       "      <td>2181.738667</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2020-04-01 14:01:29</td>\n",
       "      <td>2752.225827</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2020-04-01 14:31:29</td>\n",
       "      <td>2003.979045</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2020-04-01 15:01:29</td>\n",
       "      <td>2348.234105</td>\n",
       "      <td>1</td>\n",
       "      <td>15</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            DateHeure    Puissance  Jour  Heure  Mois\n",
       "0 2020-04-01 13:01:29  1562.445517     1     13     4\n",
       "1 2020-04-01 13:31:29  2181.738667     1     13     4\n",
       "2 2020-04-01 14:01:29  2752.225827     1     14     4\n",
       "3 2020-04-01 14:31:29  2003.979045     1     14     4\n",
       "4 2020-04-01 15:01:29  2348.234105     1     15     4"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1e41b72b9b0>"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEGCAYAAACUzrmNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3df5TddX3n8edrfjAJBElIIgWSNCixFo4m2imFk54uVUTkdI0twqLHgl3Pxm7hrK4oULdHXNRzhBaoPW3dg0KFbpVGoybt8dRS0Lp2BRnYISGgZZYimYQNMQRIIBkyM+/9434vuTPM/fWd+X7vd7739Thnztz7ud/v3M+9873f9/fzeX8+n6uIwMzMrJGeTlfAzMyKz8HCzMyacrAwM7OmHCzMzKwpBwszM2uqr9MVyMKyZcti9erVna6Gmdm88uCDD/48IpbP9Fgpg8Xq1asZGhrqdDXMzOYVST+r95i7oczMrCkHCzMza8rBwszMmnKwMDOzpjILFpIWSPqxpIcl7ZD035Py0yTdL+lxSX8r6ZikfCC5P5I8vrrmb/1hUv5TSe/Mqs5mZjazLFsWY8DbImItsA64QNLZwA3ALRGxBtgPfCjZ/kPA/og4Hbgl2Q5JZwCXAmcCFwB/Kak3w3qb2RzYd3CMh3c+x76DY52uis2BzIJFVBxM7vYnPwG8DfhGUn4H8J7k9obkPsnjb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OOykinobKyQN4bYfr00lXStqWdFOVvuullqTVwFuA++nCY8LB4qimK9t2mfUR8VYq3XJXSPqNTlfIOu6LwOuBdcDTwE2drU5+JC0CNgMfjYgXOl2fTnCwOMor29aIiN3J72eAb1HpputWeySdDJD8fqbD9emIiNgTERMRMQl8iS45JiT1UwkUfxMR30yKu+6YcLA46gFgjaTTJB0DXAps7XCdOkLScZKOr94GzgceabxXqW0FLk9uXw5s6WBdOqZ6ckz8Nl1wTEgScBvwWETcXPNQ1x0TnsFdIxkK+KccXdn2cx2uUkdIeh2V1gRUFpv8are8F5K+BpxLZRnqPcB1wLeBTcAq4Cng4ogodfK3zvtwLpUuqACeBD5c7bcvK0m/DvwvYDswmRR/kkreoruOCQcLMzNrxt1QZmbWlIOFmZk15WBhZmZNOViYmVlTDhZmZtaUg4VZSpIOTrv/QUl/3qn6mGXJwcKsYFThz6YVig9IswxIWi5ps6QHkp/1SfmnJX28ZrtHJK1Ofh6T9JfAQ8BKSedL+pGkhyR9PVmfyKwjHCzM0ltY80VAw8D1NY99gcp3P/wqcBHw5Rb+3i8Bd0bEW4AXgT8CzksWdBwCPja31TdrXV+nK2A2jx2KiHXVO5I+CFS/KOo84IzK0kIAvKa63lYDP4uI+5LbZ1P5Eq5/SYcySdcAAAC5SURBVP7GMcCP5qjeZm1zsDDLRg9wTkQcqi2UNM7UFv2Cmtsv1m4K3B0R78uuimatczeUWTb+EbiyekdStQXyJPDWpOytwGl19r8PWC/p9GTbYyW9IbPamjXhYGGWjf8CDCbfKvco8PtJ+WbgxCTH8Z+Bf51p54jYC3wQ+JqkbVSCxxszr7VZHV511szMmnLLwszMmnKwMDOzphwszMysKQcLMzNrysHCzMyacrAwM7OmHCzMzKyp/w+zE+KAaPStJAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "data1 = data.head(100)\n",
    "data1.plot.scatter('Heure','Puissance')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1e41b5afa58>"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEGCAYAAACHGfl5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAcYklEQVR4nO3de5RU9Znu8e/TF7rBACKXFmg8kAwJEgY6DIKR6NKQEbxMMIkmmpwEszRkVjSTzEw8i+TMUWPGWckaJ+bEZDROYGI8iXiJGqIkipiMSRy5GBFBVFol0oI0gnQj0E1f3vNH7W6K7uor1V1F+3zWqrX3fvdv7/ptqqmn9qV2KSIwM7N3toJcd8DMzHLPYWBmZg4DMzNzGJiZGQ4DMzMDinLdgc6MGjUqJk6cmOtumJkdV55++uk3I2J0T5bJ6zCYOHEi69evz3U3zMyOK5L+3NNlfJjIzMwcBmZm5jAwMzPy/JyBvfM0NDRQVVVFXV1drrsyYJSWllJeXk5xcXGuu2J5zGFgeaWqqoqhQ4cyceJEJOW6O8e9iGDPnj1UVVUxadKkXHfH8liXh4kklUpaK+lZSZslfTOpT5K0RtJWSXdLGpTUS5LpymT+xLR1fT2pvyhpfl9tlB2/6urqGDlypIMgSyQxcuRI72lZl7pzzqAe+HBEzAAqgAWSTge+A9wcEZOBt4ArkvZXAG9FxF8ANyftkDQVuBR4P7AA+HdJhdncGBsYHATZ5X9P644uwyBS3k4mi5NHAB8G7kvqdwAXJeMLk2mS+fOU+mtcCCyPiPqIeBWoBGZ39tz7DjX0YFOOL6/tOcjSP7ya6270mfv/VMWPf/9Krrth1k5E8Putu3PdjT5T19DUq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1GU6sCZt3jeBZyJiOvAN4KcZlr8WmB8RM0jdzM4s7zkMzNqIiI3ARFJ7BSvbzP4QcGfS7nFgpKThbdr8EfiJpC+Q+nEYs7znMDDLbAWp+/q3vYmZMrQ96p4uEfG3wD+Ruk/+huQ+OGZ5zWFgltky4IaIeK5N/QngMwCSzgbejIja9AaS3hMRayLiWuBNBuaPp9gA46uJzDKIiCpSv+Pc1vWkfsFtI6nfP16Uoc2/Jr+rK1K/P/tsX/XTLFt811IzM/NhIjMzcxiYmRkOAzMzw2FgZmY4DMzMDIeBmZnhMDAzM+D/AyY6MKXqQ5XYAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "data.plot('Mois','Puissance')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['HeureEtude'] = np.zeros(data.shape[0])\n",
    "data['MoisEtude'] = np.zeros(data.shape[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(1,7):\n",
    "    data['MoisEtude'][data['Mois'] == i]=1\n",
    "for i in range(9,13):\n",
    "    data['MoisEtude'][data['Mois'] == i]=1\n",
    "for i in range (8,20):\n",
    "    data['HeureEtude'][data['Heure'] == i]=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DateHeure</th>\n",
       "      <th>Puissance</th>\n",
       "      <th>Jour</th>\n",
       "      <th>Heure</th>\n",
       "      <th>Mois</th>\n",
       "      <th>HeureEtude</th>\n",
       "      <th>MoisEtude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2020-04-01 13:01:29</td>\n",
       "      <td>1562.445517</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2020-04-01 13:31:29</td>\n",
       "      <td>2181.738667</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2020-04-01 14:01:29</td>\n",
       "      <td>2752.225827</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2020-04-01 14:31:29</td>\n",
       "      <td>2003.979045</td>\n",
       "      <td>1</td>\n",
       "      <td>14</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2020-04-01 15:01:29</td>\n",
       "      <td>2348.234105</td>\n",
       "      <td>1</td>\n",
       "      <td>15</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2020-04-01 15:31:29</td>\n",
       "      <td>1502.650369</td>\n",
       "      <td>1</td>\n",
       "      <td>15</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2020-04-01 16:01:29</td>\n",
       "      <td>1781.384275</td>\n",
       "      <td>1</td>\n",
       "      <td>16</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2020-04-01 16:31:29</td>\n",
       "      <td>2985.651120</td>\n",
       "      <td>1</td>\n",
       "      <td>16</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2020-04-01 17:01:29</td>\n",
       "      <td>2625.745700</td>\n",
       "      <td>1</td>\n",
       "      <td>17</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2020-04-01 17:31:29</td>\n",
       "      <td>2049.410457</td>\n",
       "      <td>1</td>\n",
       "      <td>17</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2020-04-01 18:01:29</td>\n",
       "      <td>2026.813647</td>\n",
       "      <td>1</td>\n",
       "      <td>18</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2020-04-01 18:31:29</td>\n",
       "      <td>2360.017657</td>\n",
       "      <td>1</td>\n",
       "      <td>18</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2020-04-01 19:01:29</td>\n",
       "      <td>104.163034</td>\n",
       "      <td>1</td>\n",
       "      <td>19</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2020-04-01 19:31:29</td>\n",
       "      <td>145.449244</td>\n",
       "      <td>1</td>\n",
       "      <td>19</td>\n",
       "      <td>4</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>2020-04-01 20:01:29</td>\n",
       "      <td>183.481722</td>\n",
       "      <td>1</td>\n",
       "      <td>20</td>\n",
       "      <td>4</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>2020-04-01 20:31:29</td>\n",
       "      <td>133.598603</td>\n",
       "      <td>1</td>\n",
       "      <td>20</td>\n",
       "      <td>4</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2020-04-01 21:01:29</td>\n",
       "      <td>156.548940</td>\n",
       "      <td>1</td>\n",
       "      <td>21</td>\n",
       "      <td>4</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2020-04-01 21:31:29</td>\n",
       "      <td>100.176691</td>\n",
       "      <td>1</td>\n",
       "      <td>21</td>\n",
       "      <td>4</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>2020-04-01 22:01:29</td>\n",
       "      <td>118.758952</td>\n",
       "      <td>1</td>\n",
       "      <td>22</td>\n",
       "      <td>4</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>2020-04-01 22:31:29</td>\n",
       "      <td>199.043408</td>\n",
       "      <td>1</td>\n",
       "      <td>22</td>\n",
       "      <td>4</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             DateHeure    Puissance  Jour  Heure  Mois  HeureEtude  MoisEtude\n",
       "0  2020-04-01 13:01:29  1562.445517     1     13     4         1.0        1.0\n",
       "1  2020-04-01 13:31:29  2181.738667     1     13     4         1.0        1.0\n",
       "2  2020-04-01 14:01:29  2752.225827     1     14     4         1.0        1.0\n",
       "3  2020-04-01 14:31:29  2003.979045     1     14     4         1.0        1.0\n",
       "4  2020-04-01 15:01:29  2348.234105     1     15     4         1.0        1.0\n",
       "5  2020-04-01 15:31:29  1502.650369     1     15     4         1.0        1.0\n",
       "6  2020-04-01 16:01:29  1781.384275     1     16     4         1.0        1.0\n",
       "7  2020-04-01 16:31:29  2985.651120     1     16     4         1.0        1.0\n",
       "8  2020-04-01 17:01:29  2625.745700     1     17     4         1.0        1.0\n",
       "9  2020-04-01 17:31:29  2049.410457     1     17     4         1.0        1.0\n",
       "10 2020-04-01 18:01:29  2026.813647     1     18     4         1.0        1.0\n",
       "11 2020-04-01 18:31:29  2360.017657     1     18     4         1.0        1.0\n",
       "12 2020-04-01 19:01:29   104.163034     1     19     4         1.0        1.0\n",
       "13 2020-04-01 19:31:29   145.449244     1     19     4         1.0        1.0\n",
       "14 2020-04-01 20:01:29   183.481722     1     20     4         0.0        1.0\n",
       "15 2020-04-01 20:31:29   133.598603     1     20     4         0.0        1.0\n",
       "16 2020-04-01 21:01:29   156.548940     1     21     4         0.0        1.0\n",
       "17 2020-04-01 21:31:29   100.176691     1     21     4         0.0        1.0\n",
       "18 2020-04-01 22:01:29   118.758952     1     22     4         0.0        1.0\n",
       "19 2020-04-01 22:31:29   199.043408     1     22     4         0.0        1.0"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [],
   "source": [
    "train = data.iloc[0:7000,:]\n",
    "test = data.iloc[7000:,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train = train[['Jour','Heure','Mois','HeureEtude','MoisEtude']]\n",
    "Y_train = train['Puissance']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_test = test[['Jour','Heure','Mois','HeureEtude','MoisEtude']]\n",
    "Y_test = test['Puissance']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Entrainement du modle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression(copy_X=True, fit_intercept=True, n_jobs=None, normalize=False)"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Model = linear_model.LinearRegression()\n",
    "\n",
    "# Train the model using the training sets\n",
    "Model.fit(X_train, Y_train)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Prediction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 541.77091184,  541.77091184,  541.22124232, ..., 1198.88216381,\n",
       "        416.80765393,  416.80765393])"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Model.predict(X_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Coefficient R"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.34852852978549054"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Model.score(X_test, Y_test)"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Aucun(e)",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

Credits

houda lahlou

houda lahlou

1 project • 0 followers
Kenzi Sarra

Kenzi Sarra

0 projects • 0 followers

Comments

Add projectSign up / Login