<?php 
$query = "SELECT * FROM ecommerce.apriori";
$title = "Recommendation rules";
query_and_print_table($query, $title);
echo "";
?>

	<p>We build a log-log linear regression model of the revenues per product using the quantity purchased by the different customers as explanatory factors. We consider each different product as a new observation of the revenue generated. Other explanatory factors have been considered such as the price of the product, the quantity per product, the average expenses, or the mean product price. However, the quantity of each product purchased by the different customers gave the best interpretability of the results and provides the best matching to the recommendation system. Since most of the customers only bought a small fraction of the products our data matrix is sparse. We use the Lasso regression since it is optimal for sparse data, but also because it allows us to focus on the most relevant customers.</p>

	<p>The table below shows the coefficients of the LASSO Regression. We have used the results of this regression to rank customers according to their <b>percentage monetary contribution</b> to total revenues from buying an additional 1% of products. We believe that this analysis would help the sales team in two aspects:</p>

		<ul style="list-style-type:circle">

  			<li> Identify the most promising customers for their marketing activities to target. The customers with larger percentage monetary contribution are the most susceptible to increase their expenses either by increasing the quantity of the products they usually have in the basket or by purchasing products they have not tried yet. <a href="http://80y.mjt.lu/nl/80y/s6gjl.html#" target="_blank">(...and they may be amenable to suggestions like these...)</a></li>

			<li> Relax the potentially over-estimation of certain clients. For example, the client SAVEA is the client that generated more revenue for the firm <em>(see plot "Customers by Revenue")</em> up to now. However, according to the results of the LASSO analysis, it is not the client that will increase the most the firm's marginal revenue when buying "an average product". We strongly suggest doing this exercise (the LASSO Regression) before every new marketing campaign, to update the ranking of the "most interesting revenue generating customers"</li>
		
		</ul>

<?php 
$query = "SELECT * FROM ecommerce.top_customers";
$title = "Top customers by marginal revenue contribution";
query_and_print_table($query, $title);
echo "";
?>

		</div>
<?php 
// Close connection
mysql_close($link);
Example #2
0
?>
      </select>
      <input type="submit" name="submit" value="Submit">
    </form>
  
    <?php 
if (isset($_POST['submit'])) {
    $query3 = "SELECT artist_title FROM omsong.song_metadata WHERE song_id = ";
    $query3 .= "'" . $_POST['song_id'] . "';";
    $sql2 = mysql_query($query3);
    $sql3 = mysql_fetch_array($sql2);
    $title2 = "Recommended results for:";
    $title2 .= " " . $sql3['artist_title'];
    //$title2 .= " ".$_POST['artist_title']."blabla";
    $query2 = "SELECT rank, recommended_artist, recommended_song, album FROM omsong.results_recommender WHERE song_id = ";
    $query2 .= "'" . $_POST['song_id'] . "' ORDER BY rank;";
    query_and_print_table($query2, $title2);
}
?>

		</div>
		
<?php 
// Close connection
mysql_close($link);
?>

  </div>

</body>