Giter VIP home page Giter VIP logo

batch5_phenix_happymeal's Introduction

Phenix project - Happy meal algorithm

The main goal of this repository is to create balanced meals from a list of products

Understanding our algorithm

Overview of the balanced meal generation process

In the following workflow, EAN means European Article Number and OFF Open Food Facts.

Image

(The source code of this workflow can be found here)

Matching

We used the Naive Bayes method in order to automatically assign categories to articles according to their names.

Classifier

We used the Random Forest method (40 trees) to automatically assign categories to articles according to their nutrients (6 features).

Defining weights in grams

This algorithm works as follow:

  • If the quantity is mentioned in OFF, then converts the quantity in grams
    • if not, then compute the average of article's category quantities
  • If the article is rice, semolina, pasta or instant mashed potatoes, then multiply by a specific coefficient

Optimizer

Description can be found here.

Reallocating remaining articles

add a description here

Requirements

The numpy and openfoodfacts packages are required to properly use the repo. Tested on the following version:

import sys
import numpy, openfoodfacts
print('Python %s' % '.'.join(map(str, sys.version_info[:3])))
print('Numpy %s, Openfoodfacts %s' % (numpy.__version__, openfoodfacts.__version__))
Python 3.6.5
Numpy 1.15.0, Openfoodfacts 0.1.0

How to use it

Depending on the feature you wish to test, you may need an Internet connection (product information)

Product information

Pass a barcode (EAN) as argument of the demo script:

python product_info_demo.py 3392460480827

Meal balancing

Run a simulation with the demo script similarly as below:

python tetris_demo.py 1000 --item_max_qty 100. --portion_size 500. --overflow_thresh 0.2 --underflow_thresh 0.1

which should return the result of the algorithm:

------------
RESULT
------------
40 batches for 1 persons (portion of 500.0): 502 items
1 batches for 3 persons (portion of 500.0): 27 items
3 batches for 2 persons (portion of 500.0): 65 items
Average batch loss: 41.91587070338677
Number of remaining items: 201 portioned, 4 unportioned
Number of large items: 201
Number of unindentified items: 0

Many parameters can be adjusted with the previous arguments. To check the full list of arguments and their meaning, use the help of the parser:

python tetris_demo.py -h

Useful links

TODO

  • Implement an EAN - product information function
  • Implement a naive meal balancing algorithm
  • Explore brute force and smart optimisation techniques

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.