You are on page 1of 29

ABSTRACT:

Nutrients plays an important role in many physiological functions. Habitually low


intakes of Nutrients and in general the deficiency of this micronutrient induce changes in
biochemical pathways that can increase the risk of illness and, in particular, chronic
degenerative diseases. The assessment of Nutrients status is consequently of great
importance, however, its evaluation is difficult. The measurement of Nutrients using
blood test is the most commonly used and readily available method for assessing
Nutrients status, even if levels have no reliable correlation with total body Nutrients
levels or concentrations in specific tissues. In the healthcare industry, the patient’s
nutrition is a key factor in their treatment process. Every user has their own specific
nutritional needs and requirements. An appropriate nutrition policy can therefore help
the patient’s recovery process and alleviate possible symptoms. So our proposed system
uses non invasive technique to measure Nutrients level (Carbohydrates and proteins) in
mg/dl .

INTRODUCTION:

• Nutrients can be divided into two main classes

Macronutrients

Micronutrients

Macronutrients , which include carbohydrates, protein and fat that serve as energy
sources, as well as structural components that are essential for growth and development
and are required at regular intervals. Micronutrients are needed only in small amounts
but nevertheless are essential for the function of cell and organ system . They include
approximately 10 Vitamins and 20 Minerals, each as specific roles.The focus of this
band will be on sensors that detect and monitor nutritious components.

One of the biggest hurdles in healthcare is decision making, as every option has its
advantages and possible complications, which may jeopardise the human life. A recent
solution to this problem is the implementation of Decision Support Systems (DSSs).
When applied to healthcare, these systems can improve the patient’s quality of life,
offering personalised and patient-focused suggestions. The patient’s nutrition is a key
component in its treatment and recovery process. Medical nutrition therapy, also called
nutrition therapy, use nutrition as a treatment process. A person’s nutrition status is
checked, and given the right foods or nutrient to treat conditions, such as those caused
by diabetes, heart disease, and cancer. A medical nutrition therapy policy may also help
patients recover more quickly, spending less time in the hospital. In this context, this
project has emerged, consisting in the development and exploration of a new platform
for detecting nutrition’s and incorporating machine learning algorithms for decision
support.

NEED FOR STUDY:

A healthy lifestyle in people is achieved by having balanced and nutritional food. In


today's world we do not know with absolute certainty what foods can be consumed and
what cannot be consumed, that is, we do not know for sure what foods have good
nutritional value and what foods do not. The nutritional facts label is printed on food
products all over the world and they are represented using a similar structure. These
nutritional facts give data about some of the major nutrients present in the food product
such as carbohydrates, protein and so on. These nutrition fact labels are not easily
understood by common people. People who are careful about their diet such as those
who exercise and diet regularly, trainers, and nutritionists may understand these
nutritional facts, but not the common people. To make this information accessible in an
easier way by classifying these food products into five levels of healthiness ranging
from very healthy to very dangerous is the aim of this project work. This is done by a
sequential process of data retrieval, data cleaning, data labelling and supervised learning.

KNN ALGORITHM:

In statistics, the k-nearest neighbors algorithm (k-NN) is a non-parametric supervised


learning method first developed by Evelyn Fix and Joseph Hodges in 1951, and later
expanded by Thomas Cover. It is used for classification and regression. In both cases,
the input consists of the k closest training examples in a data set. The output depends on
whether k-NN is used for classification or regression:

In k-NN classification, the output is a class membership. An object is classified by a


plurality vote of its neighbours, with the object being assigned to the class most common
among its k nearest neighbours (k is a positive integer, typically small). If k = 1, then the
object is simply assigned to the class of that single nearest neighbour.

In k-NN regression, the output is the property value for the object. This value is the
average of the values of k nearest neighbours.

k-NN is a type of classification where the function is only approximated locally and all
computation is deferred until function evaluation. Since this algorithm relies on distance
for classification, if the features represent different physical units or come in vastly
different scales then normalizing the training data can improve its accuracy dramatically.

Both for classification and regression, a useful technique can be to assign weights to the
contributions of the neighbours, so that the nearer neighbours contribute more to the
average than the more distant ones. For example, a common weighting scheme consists
in giving each neighbour a weight of 1/d, where d is the distance to the neighbour.

The neighbours are taken from a set of objects for which the class (for k-NN
classification) or the object property value (for k-NN regression) is known. This can be
thought of as the training set for the algorithm, though no explicit training step is
required.

LITERATURE SURVEY:

[1]. The results obtained are available to research workers in the area of human nutrition
at a running cost and helps them in further analysis. Cow burn et al. published a research
paper which explores the understanding of nutrition fact labels in Europe. The results
showed that only 9% of nutrition fact labels were judged to be of high or medium high
quality. This supports the premise of this manuscript

[2]. The reported use of nutrition labeling was found to be high, but the objective usage
of nutrition fact labels while buying food products were found to be low. It is reported
that while users understood some aspects of the food labeling, the information in the
food labels made them confused. Most users were able to decipher simple information
from the food labels but the ability to interpret the nutrition labels decreases as the
complexity of the task increases. A comparison of five health and diet surveys done by
Bender et al. provides estimates of numbers of consumers who have paid attention to
ingredient lists and nutrition labels and identify the trends based on replicated measures

[3]. It reports that more than four out of five consumers pay attention to one or both
types of label information. Consumers who read both types of labeling information are
likely to be young, better educated, and follow a self-initiated or doctor-prescribed low
sodium or low cholesterol diet. The food labels are viewed as an important source of
information to consumers according to Margareta Wendel

[4]. The result from the study suggests that many consumers have difficulties when
trying to understand this information. The consumers felt that the terminology on the
food labels appeared technical and very advanced to them [4]. They have dealt with
these problems in various ways. Some made use of the labels to a limited extent whereas
some did not even use the labels. Some thought that reading the label consumed too
much time or that it was very difficult. Rules for novel foods and genetically modified
foods are analysed by Cheftel

[5]. The nutritional labelling directive is detailed, together with foods for particular
nutritional uses and food supplement rulings. Critical surveys on implementation of
nutrition and food labelling are summarized, with corresponding recommendations for
improvement. Instead of looking at separate nutrients or foods, pattern analysis
examines the effect of overall diet of a consumer. Dietary patterns show a broader
picture of nutrient and food consumption, and hence may be useful to predict disease
risk

[6]. Studies by Frank B. Hu have suggested that dietary patterns from cluster or factor
analysis predict disease, risk or mortality. The association between soft drink
consumption and nutrition and health outcomes and health outcomes is analyzed by
Vartanian et al

[7]. A clear association of soft drink intake with increased energy intake was noted. Soft
drink intake was also associated with lower intakes of milk, calcium and other nutrients
with an increased risk of several medical problems such as diabetes

[8]. Chowdhury et al. summarize evidence about associations between fatty acids and
cardiovascular health using observational studies and randomized, controlled trials

[9]. Seventy-two unique studies were identified over various continents. There were 45
prospective, observational studies and 27 randomized studies. A clear correlation
between fatty acids and cardiovascular health was found out. The article by Variam et al.
provides a model that measures how much factors such as nutrition knowledge and diet
awareness influence an individual’s Health Eating Index (HEI)

[10]. The results show that one’s level of nutrition information has an influence on one’s
HEI, it also shows that higher education leads to healthful choices. From the above
literature survey it is clear that there is a strong correlation between the kind of nutrients
which the consumers’ intake and their health. It is also seen that there is a lot of
difficulty involved in interpreting nutrient fact labels by the consumers. Dietary patterns
are important and influence how healthy a person is and will be. This manuscript is
based on the above research papers and implements a system for predicting the
healthiness of a particular food item based on the nutrients available in common
nutritional labels. The manuscript follows a sequential process of data collection by
retrieving nutrition data using web scraping. The data is collected from the Canadian
Government's heath website. The health website contains nutrient data for about 1200
commonly used foods. The system uses these nutrients as features for training and
testing using supervised machine learning algorithms. The food products are labelled
from 0 to 4. The class label 0 representing the healthiest and 4 representing the
unhealthiest food product. To develop a classification system, the class labels of the
food products 0 through 4 are assigned under the guidance of nutritionists. A
performance analysis of algorithms is done using the accuracy parameter. From the
literature survey it is seen that there is no similar analysis of nutrient facts of food using
supervised learning techniques and hence this article aims to help consumers choose
food products more wisely.

METHODOLOGY:
 The spectral sensor emits three IR(Infrared) light with different wavelength, it
penetrate through the skin and gets reflected back from the components of the
blood and water content.

 Then the values obtained are given to Raspberry pi where the pre-defined data set
of carbohydrates and protein are coded using Python.

 The machine learning does two different processes (Training and Testing) , the
date set is trained and the machine learns those values this is called as training
process. Whereas the comparison of those values is called as Testing process.

 Finally within a fraction of seconds the parameters are displayed in the LCD
display in both gram per day(g/dl) and percentage (%) per day.
HARDWARE DESCRIPTION

4.1 RASPBERRY PI:

The Raspberry Pi Zero Model B+ is the latest product in the Raspberry Pi Zero range,
boasting a 64-bit quad core processor running at 1.4GHz, dual-band 2.4GHz and 5GHz
wireless LAN, Bluetooth 4.2/BLE, faster Ethernet, and PoE capability via a separate
PoE HAT The dual-band wireless LAN comes with modular compliance certification,
allowing the board to be designed into end products with significantly reduced wireless
LAN compliance testing, improving both cost and time to market. The Raspberry Pi
Zero Model B+ maintains the same mechanical footprint as both the Raspberry Pi 2
Model B and the Raspberry Pi Zero Model B.
The Raspberry Pi Compute Module 3+ (CM3+) is a range of DDR2-SODIMM-
mechanically-compatible System on Modules (SoMs) containing processor, memory,
eMMC Flash (on non-Lite variants) and supporting power circuitry. These modules
allow a designer to leverage the Raspberry Pi hardware and software stack in their own
custom systems and form factors. In addition these modules have extra IO interfaces
over and above what is available on the Raspberry Pi model A/B boards, opening up
more options for the designer. The CM3+ contains a BCM2837B0 processor (as used on
the Raspberry Pi 3B+), 1Gbyte LPDDR2 RAM and eMMC Flash. The CM3+ is
currently available in 4 variants, CM3+/8GB, CM3+/16GB, CM3+/32GB and CM3+
Lite, which have 8, 16 and 32 Gigabytes of eMMC Flash, or no eMMC Flash,
respectively. The CM3+ Lite product is the same as CM3+ except the eMMC Flash is
not fitted, and the SD/eMMC interface pins are available for the user to connect their
own SD/eMMC device. Note that the CM3+ is electrically identical and, with the
exception of higher CPU z-height, physically identical to the legacy CM3 products.
CM3+ modules require a software/firmware image dated November 2018 or newer to
function correctly

Hardware

• Low cost

• Low power

• High availability

• High reliability – Tested over millions of Raspberry Pis Produced to date – Module IO
pins have 15 micro-inch hard gold plating over 2.5 micron Nickel

2.2 Peripherals

• 48x GPIO

• 2x I2C

• 2x SPI

• 2x UART

• 2x SD/SDIO

• 1x HDMI 1.3a

• 1x USB2 HOST/OTG

• 1x DPI (Parallel RGB Display)

• 1x NAND interface (SMI)

• 1x 4-lane USB Camera Interface (up to 1Gbps per lane)

• 1x 2-lane USB Camera Interface (up to 1Gbps per lane)


• 1x 4-lane DSI Display Interface (up to 1Gbps per lane)

• 1x 2-lane DSI Display Interface (up to 1Gbps per lane) 2.3 Software

• ARMv8 Instruction Set

• Mature and stable Linux software stack – Latest Linux Kernel support – Many drivers
upstreamed – Stable and well supported userland – Full availability of GPU functions
using standard APIs

Mechanical Specification The CM3+ modules conform to JEDEC MO-224 mechanical


specification for 200 pin DDR2 (1.8V) SODIMM modules and therefore should work
with the many DDR2 SODIMM sockets available on the market. (Please note that the
pinout of the Compute Module is not the same as a DDR2 SODIMM module; they are
not electrically compatible.) The SODIMM form factor was chosen as a way to provide
the 200 pin connections using a standard, readily available and low cost connector
compatible with low cost PCB manufacture. The maximum component height on the
underside of the Compute Module is 1.2mm. The maximum component height on the
top side of the Compute Module is 2.5mm. The Compute Module PCB thickness is
1.0mm +/- 0.1mm. Note that the location and arrangement of components on the
Compute Module may change slightly over time due to revisions for cost and
manufacturing considerations; however, maximum component heights and PCB
thickness will be kept as specified. Figure 2 gives the CM3+ mechanical dimensions

The Compute Module 3+ has six separate supplies that must be present and powered at
all times; you cannot leave any of them unpowered, even if a specific interface or GPIO
bank is unused. The six supplies are as follows: 1. VBAT is used to power the
BCM2837 processor core. It feeds the SMPS that generates the chip core voltage. 2.
3V3 powers various BCM2837 PHYs, IO and the eMMC Flash. 3. 1V8 powers various
BCM2837 PHYs, IO and SDRAM. 4. VDAC powers the composite (TV-out) DAC. 5.
GPIO0-27 VREF powers the GPIO 0-27 IO bank. 6. GPIO28-45 VREF powers the
GPIO 28-45 IO bank.

AS7263:

The AS7263 is a digital 6-channel spectrometer for spectral identification in the near IR
(NIR) light wavelengths. AS7263 consists of 6 independent optical filters whose
spectral response is defined in the NIR wavelengths from approximately 600nm to
870nm with full-width half-max (FWHM) of 20nm. An integrated LED driver with
programmable current is provided for electronic shutter applications. The AS7263
integrates Gaussian filters into standard CMOS silicon via Nano-optic deposited
interference filter technology and is packaged an LGA package that provides a built in
aperture to control the light entering the sensor array. Control and Spectral data access is
implemented through either the I²C register set, or with a high level AT Spectral
Command set via a serial UART.

AS7263 spectral conversion is implemented via two photodiode banks per device. Bank
1 consists of data from the S, T, U, V photodiodes. Bank 2 consists of data from the R,
T, U, W photodiodes. Spectral conversion requires the integration time (IT in ms) set to
complete. If both photodiode banks are required to complete the conversion, the 2nd
bank requires an additional IT ms. Minimum IT for a single bank conversion is 2.8 ms.
If data is required from all 6 photodiodes then the device must perform 2 full
conversions (2 x Integration Time). The spectral conversion process is controlled with
BANK Mode settings as follows: BANK Mode 0: Data will be available in registers S,
T, U & V (R and W registers will be zero) BANK Mode 1: Data will be available in
registers R, T, U & W (V and W registers will be zero) BANK Mode 2: Data will be
available in registers R, S, T, U, V & W When the bank setting is Mode 0, Mode 1, or
Mode 2, the spectral data conversion process operates continuously, with new data
available after each IT ms period. In the continuous modes, care should be taken to
assure prompt interrupt servicing so that integration values from both banks are all
derived from the same spectral conversion cycle. BANK Mode 3: Data will be available
in registers R, S, T, U, V & W in One-Shot mode When the bank setting is Mode 3, the
device operates in One-Shot mode. Spectral conversion occurs only when bit 0 of the
control register (1SHOT) is set to 1. The 1SHOT bit in the control register is
subsequently cleared by hardware at the same time the DATA_RDY bit is set to 1
indicating the availability of spectral conversion result data. The One-Shot mode is
intended for use when it is critical to ensure that spectral conversion results are obtained
contemporaneously
OLED DISPLAY:
GENERAL DESCRIPTION SSD1306 is a single-chip CMOS OLED/PLED driver with
controller for organic / polymer light emitting diode dot-matrix graphic display system.
It consists of 128 segments and 64commons. This IC is designed for Common Cathode
type OLED panel. The SSD1306 embeds with contrast control, display RAM and
oscillator, which reduces the number of external components and power consumption. It
has 256-step brightness control. Data/Commands are sent from general MCU through
the hardware selectable 6800/8000 series compatible Parallel Interface, I 2 C interface or
Serial Peripheral Interface. It is suitable for many compact portable applications, such as
mobile phone sub-display, MP3 player and calculator, etc.

FEATURES

• Resolution: 128 x 64 dot matrix panel

• Power supply o VDD = 1.65V to 3.3V for IC logic o VCC = 7V to 15V for Panel
driving
• For matrix display o OLED driving output voltage, 15V maximum o Segment
maximum source current: 100uA o Common maximum sink current: 15mA o 256 step
contrast brightness current control

• Embedded 128 x 64 bit SRAM display buffer

• Pin selectable MCU Interfaces: o 8-bit 6800/8080-series parallel interface o 3 /4 wire


Serial Peripheral Interface o I 2 C Interface

• Screen saving continuous scrolling function in both horizontal and vertical direction

• RAM write synchronization signal

• Programmable Frame Rate and Multiplexing Ratio

• Row Re-mapping and Column Re-mapping

• On-Chip Oscillator

• Chip layout for COG & COF • Wide range of operating temperature: -40°C to 85°C

LITHIUM ION BATTERY:

A lithium-ion (Li-ion) battery is an advanced battery technology that uses lithium


ions as a key component of its electrochemistry. During a discharge cycle, lithium
atoms in the anode are ionized and separated from their electrons. The lithium ions
move from the anode and pass through the electrolyte until they reach the cathode,
where they recombine with their electrons and electrically neutralize. The lithium
ions are small enough to be able to move through a micro-permeable separator
between the anode and cathode. In part because of lithium’s small size (third only to
hydrogen and helium), Li-ion batteries are capable of having a very high voltage and
charge storage per unit mass and unit volume.

Li-ion batteries can use a number of different materials as electrodes. The most
common combination is that of lithium cobalt oxide (cathode) and graphite (anode),
which is most commonly found in portable electronic devices such as cellphones and
laptops. Other cathode materials include lithium manganese oxide (used in hybrid
electric and electric automobiles) and lithium iron phosphate. Li-ion batteries
typically use ether (a class of organic compounds) as an electrolyte.

ADVANTAGES:

Compared to the other high-quality rechargeable battery technologies (nickel-


cadmium or nickel-metal-hydride), Li-ion batteries have a number of advantages.
They have one of the highest energy densities of any battery technology today (100-
265 Wh/kg or 250-670 Wh/L). In addition, Li-ion battery cells can deliver up to 3.6
Volts, 3 times higher than technologies such as Ni-Cd or Ni-MH. This means that
they can deliver large amounts of current for high-power applications, which has Li-
ion batteries are also comparatively low maintenance, and do not require scheduled
cycling to maintain their battery life. Li-ion batteries have no memory effect, a
detrimental process where repeated partial discharge/charge cycles can cause a
battery to ‘remember’ a lower capacity. This is an advantage over both Ni-Cd and Ni-
MH, which display this effect. Li-ion batteries also have low self-discharge rate of
around 1.5-2% per month. They do not contain toxic cadmium, which makes them
easier to dispose of than Ni-Cd batteries.

Due to these advantages, Li-ion batteries have displaced Ni-Cd batteries as the
market leader in portable electronic devices (such as smartphones and laptops). Li-
ion batteries are also used to power electrical systems for some aerospace
applications, notable in the new and more environmentally friendly Boeing 787,
where weight is a significant cost factor. From a clean energy perspective, much of
the promise of Li-ion technology comes from their potential applications in battery-
powered cars. Currently, the bestselling electric cars, the Nissan Leaf and the Tesla
Model S, both use Li-ion batteries as their primary fuel source.
SOFTWARE DESCRIPTION:

PYTHON 3.7:

Python is an interpreter, high-level, general-purpose


programming language. Created by Guido van Rossum and first released
in 1991, Python's design philosophy emphasizes code readability with its
notable use of significant whitespace.

Python is an easy to learn, powerful programming language. It has


efficient high-level data structures and a simple but effective approach to
object- oriented programming. Python’s elegant syntax and dynamic
typing, together with its interpreted nature, make it an ideal language for
scripting and rapid application development in manya reason most
platforms and
may be freely distributed. The same site also contains distributions of and
pointers to many free third party Python modules, programs and tools,
and additional documentation. The Python interpreter is easily extended
with new functions and data types implemented in C or C++ (or other
languages callable from C). Python is also suitable as an extension
language for customizable applications. This tutorial introduces the reader
informally to the basic concepts and features of the Python language and
system. It helps to have a Python interpreter handy for hands-on
experience, but all examples are self-contained, so the tutorial can be read
off- line as well. For a description of standard objects and modules, see
library-index. Reference-index gives a more formal definition of the
language. To write extensions in C or C++, read extending-index and c-
api-index. There are also several books covering Python in depth. This
tutorial does not attempt to be comprehensive and cover every single
feature, or even every commonly used feature. Instead, it introduces many
of Python’s most notes worthy features, and will give you a good idea of
the language’s flavor and style. After reading it, you will be able to read
and write Python modules and programs, and you will be ready to learn
more about the various Python library modules described in library-index.
If you do much work on computers, eventually you find that there’s some
task you’d like
to automate. For example, you may wish to perform a search-and-
replace over a large number of text files, or rename and rearrange a
bunch of photo files in a complicated way. Perhaps you’d like to write a
small custom database, or a specialized
GUI application or a simple game. If you’re a professional
software developer, you may have to work with several
C/C++/Java libraries but find the usual write/compile/test/re-
compile cycle is too slow. Perhaps you’re writing a test suite for
such a library and find writing the testing code a tedious task. Or
maybe you’ve written a program that could use an extension
language, and you don’t want to design and implement a whole
new language for your application.

Typing an end-of-file character (Control-D on Unix,


Control-Z on Windows) at the primary prompt causes the
interpreter to exit with a zero exit status. If that doesn’t work, you
can exit the interpreter by typing the following command: quit().
The interpreter’s line-editing features include interactive editing,
history substitution and code completion on systems that support
read line. Perhaps the quickest check to see whether command
line editing is supported is typing Control-P to the first Python
prompt you get. If it beeps, you have command line editing; see
Appendix Interactive Input Editing and History Substitution for
an introduction to the keys. Ifnothing appears to happen, or if ^P
is echoed, command line editing isn’t available; you’ll only be
able to use backspace to remove characters from the current line.
The interpreter operates somewhat like the Unix shell: when
called with standard input connected to a tty device, it reads and
executes commands interactively; when called with a file name
argument or with a file as standard input, it reads and executes a
script from that file. A second way of starting the interpreter is
python -c command [arg] ..., which executes the statement(s) in
command, analogous to the shell’s -c option. Since Python
statements often contain spaces or other characters that are
special to the shell, it is usually advised to quote commands in its
entiretywithsinglequotes.SomePythonmodulesarealsousefulasscri
pts. These can be invoked using python-m module [arg]...,which
executes the source file for the module as if you had spelled out
its full name on the command line. When a script file is used, it is
sometimes useful to be able to run the script and enter interactive
mode afterwards. This can be done by passing -i before the script.

There are tools which use doc strings to automatically produce


online or printed documentation or to let the user interactively
browse through code; it’s good practice to include doc strings in
code that you write, so make a habit of it. The execution of a
function introduces a new symbol table usedfor the local
variables of the function. More precisely, all variable assignments
in a functions to read the value in the local symbol table; whereas
variable references first look in the local symbol table, then in the
local symbol tables of enclosing functions, then in the global
symbol table, and finally in the table of built-in names. Thus,
global variables cannot be directly assigned a value within a
function (unless named in a global statement), although they may
be referenced. The actual parameters (arguments) to a function
call are introduced in the local symbol table of the called function
when it is called; thus, arguments are passed using call by value
(where the value is always an object reference, not the value of
the object).1 When a function calls another function, a new local
symbol table is created for that call. A function definition
introduces the function name in the current symbol table. The
value of the function name has a type that is recognized by the
interpreter as a user-defined function. This value can be assigned
to another name which can then also be used as a function.

Annotations are stored in the annotations attribute of the function


as a dictionary and haven o effect on any other part of the
function. Parameter annotations are defined by a colon after the
parameter name, followed by an expression evaluating to the
value of the annotation. Return annotationsare defined by a literal
->, followed by an expression, between the parameter list and the
colon denoting the end of the def statement.

The comparison operators in and not in check whether a value


occurs (does not occur) in a sequence. The operator is and does
not compare whether two objects are really the same object; this
only matters for mutable objects like lists. All comparison
operators have the same priority, which is lower than that of all
numerical operators. Comparisons can be chained. For
example,a<b==ctestswhetheraislessthanbandmoreoverbequalsc.
Comparisons may be combined using the Boolean operators and
the outcome of a comparison (or of any other Boolean
expression) may be negated with not. These have lower priorities
than comparison operators; between them, not has the highest
priority and or the lowest, so that A and not B or C is equivalent
to (A and (not B)) or C. As always, parentheses can be used to
express the desired composition. The Boolean operators and are
so-called short-circuit operators: their arguments are evaluated
from left to right, and evaluation stops as soon as the outcome is
determined. For example, if A and C are true but Bis false, A and
B and C does not evaluate the expression C. When used as a
general value and not as a Boolean, the return value of a short-
circuit operator is the last evaluated argument.
Classes provide a means of bundling data and functionality
together. Creating a new class creates a new type of object,
allowing new instances of that type to be made. Each class
instance can have attributes attached to it for maintaining its state.
Class instances can also have methods (defined by its class) for
modifying its state. Compared with other programming
languages, Python’s class mechanism adds classes with a
minimum of new syntax and semantics. It is a mixture of the
class mechanisms found in C++ and Modula-3. Python classes
provide all the standard features of Object Oriented
Programming: the class inheritance mechanism allows multiple
base classes, a derived class can override any methods of its base
class or classes, and a method can call the method of a base class
with the same name. Objects can contain arbitrary amounts and
kinds of data. As is true for modules, classes partake of the
dynamic nature of Python: they are created at runtime, and can be
modified further after creation. In C++ terminology, normally
class members (including the data members) are public (except
see below Private Variables), and all member functions are
virtual. A sin Modula-3, there are no short hands for referencing
the object’s members from its methods: the method function is
declared with an explicit first argument representing the object,
which is provided implicitly by the call. A sin Small talk, classes
themselves are objects. This providesSemantics for importing and
renaming. Unlike C++ and Modula-3, built-in types can be used
as base classes for extension by the user. Also, like in C++, most
built-in operators with special syntax (arithmetic operators, sub
scripting etc.) can be redefined for class instances.(Lacking
universally accepted terminology to talk about classes, I will
make occasional use of Smalltalk and C++ terms. I would use
Modula-3 terms, since its object- oriented semantics are closer to
those of Python than C++, but I expect that few readers have
heard of it.)

Objects have individuality, and multiple names (in multiple


scopes) can be bound to the same object. This is known as
aliasing in other languages. This is usually not appreciated on a
first glance at Python, and can be safely ignored when dealing
with immutable basic types (numbers, strings, tuples).However,
aliasing has a possibly surprising effect on these mantic of
Python code involving mutable objects such as lists, dictionaries,
and most other types. This is usually used to the benefit of the
program, since aliases behave like pointers in some respects. For
example, passing an object is cheap since only a pointer is passed
by the implementation; and if a function modifies an object
passed as an argument, the caller will see the change — this
eliminates the need for two different argument passing
mechanisms as in Pascal.
A namespace is a mapping from names to objects.
Most name spaces are currently implemented as Python
dictionaries, but that’s normally not noticeable in any way
(except for performance), and it may change in the future.
Examples of name spaces are: these to f built-in names
(containing functions such as abs(), and built-in exception
names); the global names in a module; and the local names in a
function invocation. In a sense the set of attributes of an object
also form a namespace. The important thing to know about
namespaces is that there is absolutely no relation between names
in different namespaces; for instance, two different modules may
both define a function maximize without confusion — users of
the modules must prefix it with the module name. By the way, I
use the word attribute for any name following a dot — for
example, in the expression z. real, real is an attribute of the object
z. Strictly speaking, references to names in modules are attribute
references: in the expression modname.funcname, modname is a
module object and funcname is an attribute of it. In this case there
happens to be a straight forward mapping between the module’s
attributes and the global names defined in the module: they share
the same namespace!1 Attributes may be read-only or writable. In
the latter case, assignment to attributes is
possible. Module attributes are writable: you can

write modname.the_answer = 42. Writable attributes may also be


deleted with the del statement. For example, del mod name .the_
answer will remove the attribute the_answer from the object
named by mod name. Namespaces are created at different
moments and have different lifetimes. The namespace containing
the built-in names is created when the Python interpreter starts
up, and is never deleted. The global namespace for a module is
created when the module definition is read in; normally, module
namespaces also last until the interpreter quits.The statements
executed by the top-level invocation of the interpreter, either read
from a script file or interactively, are considered part of a module
called main, so they have their own global namespace.(The
built-in names actually also live in a module; this is called built
ins.) The local namespace for a function is created when the
function is called, and deleted when the function returns or raises
an exception that is not handled within the function. (Actually,
forgetting would be a better way to describe what actually
happens.) Of course, recursive invocations each have their own
local namespace.

To speed uploading modules, Python caches the compiled version

of each module in the pycache directory under the


name

module.version.pyc, where the version encodes the format of the


compiled
file; it generally contains the Python version number. For
example, in CPython release 3.3 the compiled version of spam.py
would be cached as
pycache/spam.cpython-33.pyc. This naming

convention allows compiled modules from different releases and


different versions of Python to coexist. Python checks the
modification date of the source against the compiled version to
see if it’s out of date and needs to be recompiled. This is a
completely automatic process. Also, the compiled modules are
platform-independent, so the same library can be shared among
systems with different architectures. Python does not check the
cache in two circumstances. First, it always recompiles and does
not store the result for the module that’s loaded directly from the
command line. Second, it does not check the cache if there is no
source module. To support anon-source (compiled only)
distribution, the compiled module must be in the source
directory, and there must not be a source module. Some tips for
experts:

• You can use the -O or -OO switches on the Python


command to reduce the size of a compiled module. The -O switch
removes assert statements, the -OO switch removes both assert
statements and doc
strings. Since some programs may rely on having these available,
you should only use this option if you know what you’re doing.
“Optimized”
modules have an opt- tag and are usually smaller. Future releases
may change the effects of optimization.

• A program doesn’t run any faster when it is read from


a .pyc file than when it is read from a .py file; the only thing
that’s faster about .pyc files is the speed with which they are
loaded.
• The module compile all can create .pyc files for all
modules in a directory.
• There is more detail on this process, including a flow chart
of the decisions
CONCLUSION:

Nutrition fact labels have been hard to discern for a long time. This project has
initiated a classification of nutrients value using spectral sensor. This
manuscript can be further improved by increasing the quantity and quality of the
data set and trying out the other machine learning algorithms in existence.

REFERENCES:

[1] Katrine I. Baghurst and Sally J. Record, “A computerised dietary analysis


system for use with diet diaries or food frequency questionnaires,” in
Community Health Studies, vol. 7, pp. 11 - 18, 1984.

[2] Gill Cowburn and Lynn Stockley, “Consumer understanding and use of
nutrition labelling: a systematic review,” in Public Health Nutrition, vol. 8, pp.
21-28, 2005.

[3] Mary M. Bender and Brenda M. Derby, “Prevalence of reading nutrition


and ingredient on food labels among adult Americans: 1982-1988,” Journal of
Nutrition Education and Behavior, vol. 24, pp. 292-297, 1992.

[4] Margareta Wandel, “Food labelling from a consumer perspective,” in British


Food Journal, vol. 99, pp. 212-219, 1997.

[5] J. Claude Cheftel, “Food and nutrition labelling in the European union”,
Food Chemistry, vol. 93, pp. 531-550, 2005.

[6] Frank B. Hu, “Dietary pattern analysis: a new direction in nutritional


epidemiology”, Current Opinion in Lipid ology, vol. 13, pp. 3-9, 2002.

[7] Lenny R. Vartanian, Marlene B. Schwartz, and Kelly D. Brownell, “Effects


of soft drink consumption on nutrition and health: a systematic review and
meta-analysis”, American Journal of Public Health, Vol. 97, No.4, pp. 667-675,
2007.

[8] M. J. Gibney, H. H. Vorster, and F. J. Kok, “Introduction to human


nutrition”, Oxford: Blackwell Publishing, 2nd ed., 2002.

[9] R. Chowdury et al., “Association of dietary, circulating, and supplement


fatty acids with coronary risk”, Annals of Internal Medicine, vol. 160, pp. 398-
406, 2014.

[10] Jay Variam, James R. Blaylock, and David Smallwood, “USDA’s healthy
eating index and nutrition information” in Economic Research Service/USDA,
Technical Bulletin No. 1866, pp. 26, 1998.

You might also like