Project 10.07.16 FINAL EDIT PDF

110
School of Engineering Implementation of Google Prediction API in the small re- tail businesses based in the United Kingdom Ivalina Ivanova STUDENT NUMBER: 3419984 A dissertation submitted in partial fulfilment of the require- ments for the degree of BSc(Hons) Computer Systems Management London South Bank University August 2016

Transcript of Project 10.07.16 FINAL EDIT PDF

Page 1: Project 10.07.16 FINAL EDIT PDF

School of Engineering

Implementation of Google Prediction API in the small re-

tail businesses based in the United Kingdom

Ivalina Ivanova

STUDENT NUMBER: 3419984

A dissertation submitted in partial fulfilment of the require-

ments for the degree of

BSc(Hons) Computer Systems Management

London South Bank University

August 2016

Page 2: Project 10.07.16 FINAL EDIT PDF

DECLARATION

This dissertation is my original work and has not been submitted elsewhere in fulfilment of the

requirements for this or any other award. Any sentences or passages taken from my previous

work or other people's work have been explicitly acknowledged by explicit referencing to au-

thor, source, and page(s). Any non-original illustrations are also referenced. I understand that

failure to do this amounts to plagiarism and will be considered grounds for failure in this dis-

sertation and the degree as a whole.

Ivalina Ivanova: _____________________________

Page 3: Project 10.07.16 FINAL EDIT PDF

ABSTRACT

The purpose of the project is to deliver clear examples of how the retail businesses in the United

Kingdom could be more competitive and how they can improve product sales by using

predictive analyses.

The aim of this project is achieved by using Google spreadsheet with embedded Prediction API

models which represent wine features such as the origin of the wine, type of grapes, year of

production, brand and wine prices, and AppSheet platform to develop the application. By using

the AppSheet software, I can convert my Google spreadsheet into a mobile app and deliver

clear results of how much could cost a bottle of wine from a given dataset by using predictive

analysis. The cost related to the wine features could be based on purchases made in any retail

shop.

The finished web application combines Google spreadsheet, Prediction API trained models and

represents outcomes of wine prices. Also, the small retail businesses are allowed to obtain

information about the possible prices of different wine products. By providing the previous

history related to the wine purchases and their prices associated with the wine features such as

the origin of the wine, type of grapes, year of production and brand the sellers can predict how

much it will cost to produce a bottle of wine in the future.

The conclusion from this investigation discovered that the implementation of the Google

Prediction API models could improve the business continuity, increase business profit and

create a competitive environment for the small retail businesses in the United Kingdom.

Page 4: Project 10.07.16 FINAL EDIT PDF

ACKNOWLEDGEMENT

The completion of this document has been one of the most substantial academic challenges

throughout my entire course. Without the provision and the help of the following participants

this will be not conceivable.

I would like to express a sincere gratefulness to my supervisor, Paul Carden, who agreed to

undertake the role as my supervisor. His guidance and knowledge have encouraged me to de-

liver the best possible outcome of the research paper.

I would like to show gratitude the developers of Prediction API, Google, and AppSheet for

giving me access to a range of fantastic websites, including all the information that an individual

could ever need.

Last but not least, I would like to show gratitude to my family and friends who have encouraged

me entirely during this process.

Page 5: Project 10.07.16 FINAL EDIT PDF

iv

Contents

DECLARATION ........................................................................................................................ i

ABSTRACT ............................................................................................................................... ii

ACKNOWLEDGEMENT ........................................................................................................ iii

Contents ..................................................................................................................................... iv

List of Figures ............................................................................................................................ v

Chapter 1: Introduction .............................................................................................................. 1

1.1 Enquiry Overview ............................................................................................................ 1

1.2 Target Audience ............................................................................................................... 2

1.3 Aims and objectives ......................................................................................................... 3

1.4 Research questions ........................................................................................................... 4

1.5 Background of the subject matter ..................................................................................... 4

1.6 Rationale of the study ....................................................................................................... 6

1.7 Scope and Limitations ...................................................................................................... 7

Chapter 2: Literature review ...................................................................................................... 8

2.1 Introduction ...................................................................................................................... 8

2.2 Conceptual Clarifications: Prediction API ....................................................................... 9

2.3 Characteristics and values of using PREDICTION API within the business ................ 10

2.3.1 Ubiquity ................................................................................................................... 17

Chapter 3: Technical Research ................................................................................................. 17

3.1 Google Cloud Platform features and Prediction API models ........................................ 17

Page 6: Project 10.07.16 FINAL EDIT PDF

v

3.1.1 Comparison between Google Cloud Platform, Amazon Machine Learning, Azure

Machine Learning ............................................................................................................ 18

3.1.2 Prediction API models ............................................................................................ 21

3.2 Android and AppSheet Mobile Operating Systems ....................................................... 21

3.2.1 Android .................................................................................................................... 22

3.2.2 Use of Google Cloud console and Prediction models for the AppSheet application

.......................................................................................................................................... 23

3.2.3 AppSheet ................................................................................................................. 24

3.2.4 Comparison between AppSheet and Android developments of application ........... 25

Chapter 4: Research Design and Methodology ........................................................................ 28

4.1 Research Approaches ..................................................................................................... 28

4.2 Research Strategy ........................................................................................................... 29

4.3 Exploratory and Explanatory Research Strategies ......................................................... 29

4.4 CASE STUDY ............................................................................................................... 30

4.5 Data Collection Methods ................................................................................................ 30

4.5.1 Primary and Secondary Data ................................................................................... 30

4.5.2 Google Spreadsheet Dataset .................................................................................... 31

4.6 Strength of methodology ................................................................................................ 32

4.7 Limitations of methodology ........................................................................................... 32

4.8 Ethics Considerations ..................................................................................................... 33

Chapter 5: Prediction API models embedded in Google Spreadsheets and Data Analysis (De-

velopment overview) ................................................................................................................ 33

Page 7: Project 10.07.16 FINAL EDIT PDF

vi

5.1 Fetching Data ................................................................................................................. 33

5.2 Initial State ..................................................................................................................... 36

Chapter 6: Implementation of Prediction API models within Google Spreadsheet and testing

of the mobile application .......................................................................................................... 46

6.1 Google App Scripts ........................................................................................................ 46

6.2 AppSheet Application Development .............................................................................. 67

Chapter 7 Reflection and recommendations for future work ................................................... 81

7.1 Introduction .................................................................................................................... 81

7.2 Evaluation of findings .................................................................................................... 82

7.3 Research data applicability to the aims and objectives of the project ............................ 83

7.4 Recommendations .......................................................................................................... 85

7.4.1 Designing a Good Model ........................................................................................ 85

7.5 Conclusion ...................................................................................................................... 86

7.6 Directions for further study ............................................................................................ 87

7.7 Summary ........................................................................................................................ 87

References: ............................................................................................................................... 88

Appendix A: ............................................................................................................................. 95

Appendix B: My Basic Script .................................................................................................. 96

Appendix C: The Script associated with Google Spreadsheet ................................................. 97

File 1: Prediction API code .................................................................................................. 97

File 2: Help Functions .......................................................................................................... 99

File 3: Methods for accessing values stored in the spreadsheet ......................................... 101

Page 8: Project 10.07.16 FINAL EDIT PDF

vii

List of Figures

Figure 1: Machine Learning: How does it work?(www.salesforce.com, 2016) ....................... 8

Figure 2: Prediction process (Dorard, L., 2014) ..................................................................... 18

Figure 3: Native, HTML5, or Hybrid (Korf, M and Oksman, E., 2015) ............................... 22

Figure 4: Google Spreadsheet dataset used for the purpose of the project (docs.google.com,

2016) ........................................................................................................................................ 24

Figure 5: Screenshot of the Google Spreadsheet development process (docs.google.com, 2016)

................................................................................................................................................. 26

Figure 6: Dataset, missing values from cell 20B to cell 27B required for predictions

(docs.google.com, 2016) ......................................................................................................... 27

Figure 7: Project development: Name selection process (cloud.google.com, 2016) .............. 28

Figure 8: First stage of the project development (cloud.google.com, 2016) .......................... 29

Figure 9: Google APIs selection options (cloud.google.com, 2016) ...................................... 29

Figure 10: Prediction API selection (cloud.google.com, 2016) .............................................. 30

Figure 11: Enabling of Prediction API (cloud.google.com, 2016) ......................................... 30

Figure 12: “Try this API in APIs Explorer”: link (cloud.google.com, 2016) ......................... 31

Figure 13: Prediction API training models (cloud.google.com, 2016) ................................... 31

Figure 14: Cloud Storage bucket formation (cloud.google.com, 2016) .................................. 32

Figure 15: Uploading of the training dataset (cloud.google.com, 2016) ................................ 32

Figure 16: Execution process of prediction.trainedmodels.insert (cloud.google.com, 2016) . 33

Figure 17: Prediction.trainedmodels.insert request and response (cloud.google.com, 2016) . 34

Figure 18: Prediction.trainedmodels.get execution process (cloud.google.com, 2016) ......... 34

Figure 19: Prediction.trainedmodels.get request and response (cloud.google.com, 2016) ..... 35

Figure 20: Prediction.trainedmodels.predict execution process (cloud.google.com, 2016) ... 35

Figure 21: Prediction.trainedmodels.predict request (cloud.google.com, 2016) .................... 36

Page 9: Project 10.07.16 FINAL EDIT PDF

viii

Figure 22: Prediction.trainedmodels.predict responses (cloud.google.com, 2016) ................ 36

Figure 23: Google App Scripts platform (script.google.com, 2016) ...................................... 37

Figure 24: Basic script used for the purpose of the project (script.google.com, 2016) .......... 38

Figure 25: Edit Project Name screenshot (script.google.com, 2016) ...................................... 38

Figure 26: Execution of the main function (script.google.com, 2016) ................................... 39

Figure 27: Google Drive access request (script.google.com, 2016) ....................................... 39

Figure 28: Checking of the Console Logs (script.google.com, 2016) .................................... 40

Figure 29: Evidence of “my basic script” and “my test document” files uploaded in the Google

Drive (drive.google.com, 2016) .............................................................................................. 40

Figure 30: “my test document” content (docs.google.com, 2016) .......................................... 41

Figure 31: Prediction Google Spreadsheet (docs.google.com, 2016) ..................................... 42

Figure 32: Google App Script associated with the spreadsheet (docs.google.com, 2016) ..... 42

Figure 33: Google App Script associated with the spreadsheet (docs.google.com, 2016) ..... 43

Figure 34: Google App Script associated with the spreadsheet (docs.google.com, 2016) ..... 44

Figure 35: Google App Script associated with the spreadsheet (docs.google.com, 2016) ..... 45

Figure 36: Activation of Prediction API (docs.google.com, 2016) ........................................ 51

Figure 37: Activation of Prediction API in the Google Developers Console (console.develop-

ers.google.com, 2016) ............................................................................................................. 51

Figure 38: Enabling of Prediction API in the Google Developers Console (console.develop-

ers.google.com, 2016) ............................................................................................................. 52

Figure 39: Confirmation that Prediction API has been enabled in the Google Developers Con-

sole (console.developers.google.com, 2016) .......................................................................... 52

Figure 40: Excel dataset spreadsheet imported in the Google Spreadsheet (docs.google.com,

2016) ........................................................................................................................................ 54

Figure 41: Selection of Excel dataset file called “spreadsheet.csv” (drive.google.com, 2016)55

Page 10: Project 10.07.16 FINAL EDIT PDF

ix

Figure 42: Importing: spreadsheet.csv (docs.google.com, 2016) ........................................... 56

Figure 43: Confirmation Script output: the dataset has been imported successfully

(docs.google.com, 2016) ......................................................................................................... 57

Figure 44: Final edit of the Google Spreadsheet before using Prediction API models

(docs.google.com, 2016) ......................................................................................................... 57

Figure 45: Authorization request for “Prediction” application (docs.google.com, 2016) ...... 58

Figure 46: Google Cloud Platform use of OAuth 2.0 for “Prediction” authentication and author-

ization (cloud.google.com, 2016) ............................................................................................ 59

Figure 47: Request of the INSERT method to begin the training of the dataset

(docs.google.com, 2016) ......................................................................................................... 60

Figure 48: Confirmation of the INSERT method efficiency (docs.google.com, 2016) .......... 60

Figure 49: “Get training status”: Confirmation of connection between Google Cloud Console

project and Google Spreadsheet (docs.google.com, 2016) ..................................................... 60

Figure 50: Results from the execution process of “predict instances” model (docs.google.com,

2016) ........................................................................................................................................ 61

Figure 51: Formatting of the results (docs.google.com, 2016) ............................................... 62

Figure 52: First stage of the application development (appsheet.com, 2016) ......................... 63

Figure 53: Name and Category selection process required for the new application

(appsheet.com, 2016) .............................................................................................................. 63

Figure 54: Selection of the Google Prediction Spreadsheet required for the application devel-

opment (appsheet.com, 2016) ................................................................................................. 64

Figure 55: Setting of the Prediction application (appsheet.com, 2016) .................................. 65

Figure 56: Welcome to AppSheet (appsheet.com, 2016) ........................................................ 65

Figure 57: AppSheet architecture (appsheet.com, 2016) ........................................................ 66

Figure 58: Build and deploy an app in three simple steps (appsheet.com, 2016) ................... 66

Page 11: Project 10.07.16 FINAL EDIT PDF

x

Figure 59: Customization options for the application (appsheet.com, 2016) ......................... 67

Figure 60: Entire view of the completed "Prediction" application (appsheet.com, 2016) ...... 67

Figure 61: Adding entries of users (appsheet.com, 2016) ....................................................... 68

Figure 62: E-mail invitation for the “Prediction” app installation (gmail.com, 2016) ........... 68

Figure 63: Google Spreadsheet results gathered from prediction models linked with the Predic-

tion application (appsheet.com, 2016) .................................................................................... 69

Figure 64: Example of a wine product within the application (appsheet.com, 2016) ............. 70

Figure 65: Adding a new data in the spreadsheet required for the evidence (appsheet.com, 2016)

................................................................................................................................................. 71

Figure 66: “Prediction” application before the execution of Prediction API models

(appsheet.com, 2016) .............................................................................................................. 71

Figure 67: “Prediction” application after the execution of Prediction API models

(appsheet.com, 2016) .............................................................................................................. 72

Figure 68: Formatting of the Columns Structure (appsheet.com, 2016) ................................. 73

Figure 69: Final look of the Prediction web application (appsheet.com, 2016) ..................... 73

Figure 70: Anatomy of the Prediction mobile application (appsheet.com, 2016) .................. 74

Page 12: Project 10.07.16 FINAL EDIT PDF

1

Chapter 1: Introduction

1.1 ENQUIRY OVERVIEW

The persistence of this project is to investigate how the implementation of the Google Predic-

tion API will impact on the small retail businesses in the United Kingdom. The aim of this

enquires overview is to inform the readers what they could expect from the rest of the research

part of this project.

Chapter one of the documentation presents the basis of the study through a comprehensive in-

troduction. Also gives a bright idea to the reader about the aims of this project by providing

contextual information and justifications of the subject matter. Furthermore, the aims and ob-

jectives are related to the formation of the search.

The second chapter is concerned with the review of the relevant information required for the

implementation of the Google Prediction models. The aim of the section is to present a solid

hypothetical basis from which the remaining part of the project will be conducted.

The third chapter announces the technical review related to the project. It is separated into four

subchapters- Google Cloud Platform features and Prediction API models, Android platform,

Google spreadsheets and AppSheet business productivity solution. The technical research is

based on the application development which could be used to deliver a positive impact on the

small retail businesses, with a particular focus on the United Kingdom.

Chapter four is primarily focused on the research methodology implemented in this dissertation.

An important feature of this chapter is the justification of the selected research path. Further-

more, the carefully chosen research pattern, the data gathering methods, and the ethical issues

Page 13: Project 10.07.16 FINAL EDIT PDF

2

are considered in this chapter. The chapter introduces the process of storing the dataset used for

the predictions in the Google spreadsheet.

Chapter five presents the production and the examination of the gathered information. A deliv-

ery of a comprehensive account of the themes assembled from the relations between the dis-

coveries and the literature and also describes the usage of Prediction API within Google Cloud

Console.

Chapter six discover step-by-step the development of the mobile application and the testing of

the application and the dataset.

Chapter seven represents my personal involvement through the steps of writing this dissertation,

the evaluation of the thesis, and the future improvements of the different parts of the application.

The chapter aims to examine the results assimilated in the investigation according to the project

objectives stated at the beginning of the subject matter. Then, chapter seven provides practical

recommendations for the small retail businesses regarding the implementation of the Google

Prediction API.

1.2 TARGET AUDIENCE

The project will be beneficial to every person who want to gain experience with Prediction API

models and develop a web application by using Google spreadsheet and AppSheet solution,

used for representing real values of possible cost of products.

It is very impressive how both the Google spreadsheet with embedded Prediction APIs models

and AppSheet combined could create a better competitive advantage for the small retail

businesses by presenting possible real values of the products that could be provided to the

customers.

Page 14: Project 10.07.16 FINAL EDIT PDF

3

The project is targeting the small retail businesses in the United Kingdom that need to improve

business sales and meet the customer’s expectations. The use of Google Prediction APIs deliv-

ers a range of benefits such as better competitive advantage, low operational cost, sales growth,

customer satisfaction and business continuity. Taken into consideration by using Prediction API

models the small retail businesses could manage their activities more efficiently.

1.3 AIMS AND OBJECTIVES

The purpose of this dissertation is to discover the possible outcomes of implementing the

Google Prediction models into the small retail businesses based in the United Kingdom. This

project will analyse the results of developing application practices and applying it to the partic-

ular case to present the values to the business.

These research purposes are to accomplish the following objectives:

- To review current literature associated with the Google Prediction API and the ways of devel-

oping a predictive application.

- To classify the key benefits of implementing the Prediction API into the small retail busi-

nesses.

- To formulate some practical background on how the application could be used as a premedi-

tated tool to achieve business objectives.

1.4 RESEARCH QUESTIONS

In order to measure the influence of the Prediction API implementation, the following questions

must be answered in this research paper to attain the objectives stated above. The research

questions are as follows:

Page 15: Project 10.07.16 FINAL EDIT PDF

4

- What are the current predictive technologies?

- How can Google Prediction API be used to develop a decision-making application?

- What is the outcome of implementing the Google Prediction API into the small retail

businesses in the United Kingdom?

- How Predictive application could be used as a strategic tool to achieve business

objectives?

1.5 BACKGROUND OF THE SUBJECT MATTER

To involve the readers of this document into the issue, I will introduce what is a Machine Learn-

ing and the Prediction API with some fundamentals. Machine Learning is linked to the artificial

intelligence (AI) which means that the computers can learn without being programmed (Mar-

garet Rouse, 2016). Fundamentally, it is a process of gathering predictions based on some data

related to the problem (G, 2010).

By using our training data, Prediction API models can absorb it and predict numeric values or

select a class that defines a new piece of data. With these competencies, users can develop

applications and achieve tasks such as predicting what goods an individual might like,

classifying emails as spam or non-spam, evaluating whether feedbacks have a positive or a

negative sentiment, or predicting how much could cost a bottle of wine for a period.

According to the project aim which is developing an application and representing possible

prices of wine products, the data is correlated to the wine features such as the origin of the wine,

type of grapes, year of production and brand.

Machine Learning is based on examples, so I will provide examples of ML to explain the con-

cepts (Dorard, 2014). The rest of the research paper will emphasise the development of the

Page 16: Project 10.07.16 FINAL EDIT PDF

5

Prediction API in use. I will continue with the review of the Prediction API to show how it will

be implemented on an actual case. The following picture represents how Machine Learning

works, Fig. 1.

Figure 1: Machine Learning: How does it work? (Salesforce, 2016)

The development process of the application is related with Cloud Computing which provides

great opportunities to organizations to become more co-operative and mobile. The motives for

choosing this topic are based on accomplishing the following aims:

- Delivering clear evidence that the businesses could increase profit by implementing

Prediction API models;

- Providing clear evidence that the businesses will reduce business costs;

- Delivering clear evidence that the businesses will develop a competitive advantage;

For practical implementation of Google Prediction API, the companies need to use Google

Cloud Console and Google Cloud Storage where the information will be kept. The Cloud Stor-

Page 17: Project 10.07.16 FINAL EDIT PDF

6

age is automatically empowered on every Google Cloud project, and the documentation pub-

lished in the Google Cloud Platform represents all the steps of using predictive models (Google

Cloud Platform, 19 August 2016).

1.6 RATIONALE OF THE STUDY

Nowadays, computers are excellent at processing information. An example of that are the mil-

lions of messages sent to the Twitter servers, which have to figure out the trends of the topics

in real time (Dorard, 2014). The problem here is based on the lack of intelligence which means

that the servers must be precisely programmed with the list of basic commands to perform

efficiently. It is a huge challenge to do specific things that people do very simply, but for which

the computers are not able to figure out the exact procedure. An example of this is the recogni-

tion of the handwritten digits. For us is an easy task, but computers need to be programmed.

There are various methods to make computers do "intelligent" or "human-like" things (ibid.,

2014) and they are related to the Artificial Intelligence (AI). An example of this is playing chess.

The AI methods in chess programs work by probing possible categorizations of moves (player

one will make one move, then player two could make these moves, then player one could make

those moves, etc.). By assessing who has better precedence at the end of each of these possible

categorizations, the program will choose the winner.

Machine Learning (ML) combines some AI methods where intelligence is based on examples

(Brownlee, 2016). Let’s look at the hand-written digits; we can customize ML by giving sam-

ples of hand-written digits as scanned images, between 0 and 9. These examples will create our

"data". The idea is to deliver a new image of a hand-written number which has never been used

before and by comparison to the scanned images, the ML will provide a prediction based on the

Page 18: Project 10.07.16 FINAL EDIT PDF

7

most similar example to the new picture (Dorard, 2014). The process is very close to what we

would do, and the ML is about making machines replicate how individuals learn.

According to the aim of this project by using Prediction APIs, the businesses will be able to

predict how much could cost a bottle of wine based on examples of wine products and their

prices.

1.7 SCOPE AND LIMITATIONS

The feasibility of the project builds on the extent of the investigation and its progress. For this

purpose, has been chosen limited to the particular field of businesses headquartered in the

United Kingdom. The percentage of opening new markets increase with every single day and

the small retail shops are a promising marvel according to the growing of the customer’s de-

mand for goods.

The research project utilizes resources related to the businesses that have been already imple-

mented Prediction API models, including the development of an application, as well as other

websites and books. Examples of how Prediction API models could be applied to any business

are expressed in the literature review. They are based on the values from implementing the

Prediction API within the business.

Also, the range of the study is limited because of time and financial restrictions which constrain

the scope of this project. Therefore, to simplify the results, the dataset requires more examples

of wine products and contributors from different retail shops. Also, the information gathered

for this investigation will be restricted to what is available regarding subordinate resources from

various websites, books, and journals.

Page 19: Project 10.07.16 FINAL EDIT PDF

8

However, the conclusion from this study will play a significant role in understanding the busi-

ness influences in consumer’s life. In spite of the limitations according to this research project

the challenge is to create an application from which retail businesses can enhance their market-

ing communication, increase their profit and their competitive advantage in the United King-

dom.

Chapter 2: Literature review

2.1 INTRODUCTION

The literature review is a significant part of the dissertation which relates the project aims and

discoveries and also shows an in-depth grasp of the subject matter (Royal Literary Fund, 2016).

This chapter intends to review literature based on examples of already implemented Prediction

API models within the business and how individuals can build Machine Learning models. I will

investigate research which provides a clear understanding of how machine learning tools could

help for sufficient sentiment analysis.

The aim is to collect theoretical literature and develop a reliable investigation. The chapter is

written in a way where I am following the project objectives and use them as guidance.

Section 2.2 aim is to deliver a clear understanding of what the Prediction API definitional term

means. Section 2.3 provide the values of using Prediction API models and mobile applications

for the business needs.

Page 20: Project 10.07.16 FINAL EDIT PDF

9

2.2 CONCEPTUAL CLARIFICATIONS: PREDICTION API

By using Google Cloud Platform, I was able to understand the meaning of Prediction API. On

the question, “What is the Prediction API?” the following answer could be given: The Predic-

tion API performs in specific tasks. By providing a new item to the Prediction API models, we

can receive numeric value for that item based on comparable examples in the training data

(Google Cloud Platform, 2016). We can refer to the example mentioned in Chapter 1 for the

scanned hand-written images. Critically viewed there has been less information published about

the Prediction API as a term.

According to (Casalboni, 12 May 2015), Google Prediction API provides a RESTful interface

which means Representational Web Transfer. The principles are easy to follow:

- Connect to the server.

- Provide a VERB and a path to a URL.

- Request an answer.

The RESTful interface is used to build Machine Learning models for the purpose of this project.

REST could be explained as an interface that works like a website in a browser, and the resource

is exposed to a program via a URL (Zazueta, 09 October 2013). To be more specific, a well-

designed RESTful API will include additional links and the programme can follow them to

request the related information.

2.3 CHARACTERISTICS AND VALUES OF USING PREDICTION API WITHIN THE BUSINESS

There are parts of this literature review section, which could be originally found in my Research

and Professional Practice (BIF_5_RPP_1516) module project proposal.

Page 21: Project 10.07.16 FINAL EDIT PDF

10

For a better understanding of the benefits of Prediction API implementation, it is essential to

comprehend the features that allow small retail businesses to leverage Prediction API models

as a part of their business strategy. Several authors have documented the key features of Google

Prediction API (Dorard, 2014), (Brownlee, 2016) and (Siegel, 11 January 2016).

The aim of reviewing the literature based on Prediction APIs is to define the way of how to

develop an application presenting the cost of different wine products which will improve my

professional skills and capabilities.

There is a significant number of documentary grounded on developing of applications. Though

the investigation is focused on Prediction APIs they will be not revised in detail, only will be

mentioned if they are suitable.

In the analysis carried out according to machine learning, (Dorard, 2014) delivers the first guide

for Prediction APIs and describes the steps of how to custom applications and express individ-

ual machine learning problem according to business purposes. Furthermore, (Kumar, 05 August

2013) states that demographic variables can predict the purchase decisions of users. The author

describes how in Chennai city premium car owners predict buyer’s choice by using Prediction

API which is related to their age, education, lifestyle, sex…etc. The example provided by (ibid.,

2013) helps to understand how businesses can target groups, develop a marketing strategy and

predict customer’s intention.

In the review of “Bootstrapping Machine Learning” (Dorard, 2014) provides clear examples of

what exactly is Machine Learning, the tips for gaining experience with Google prediction

services and ways to build up prediction models.

The author represents the characteristics of Prediction API and delivers information of how to

exploit the value of the information in different types of businesses or applications.

Page 22: Project 10.07.16 FINAL EDIT PDF

11

Dorard, (2013) identifies how Machine Learning works and the limitations that a user may face

during the developing process. The benefits of following his guidance are as follows:

- Individuals can improve user’s experience within the apps, by observing customer’s

behaviour and then by using Prediction API models to figure out users’ needs and

desires.

- Individuals can understand the value of user data and analyse prospects or predict

possible goods revenue.

- People who are interested in business development will be able to differentiate their

business and create competitive advantage by using smart app features.

According to Mulholland & P. Mc Kevitt, (10 June 2015) the participation of users could raise

levels by the use of Prediction API and is conceivable by selecting the best content from a set

of media resources. The architecture named 360-MAMSelect is described by the authors and

apply sentiment examination for the endorsement of media assets. Mulholland & P. Mc Kevitt,

(ibid., 2015) evaluate two models for sentiment examination such as EmoSenticNet and Google

Prediction API related to the purpose of this project. There are cases of how Google Prediction

API models could be applied for business purposes.

Judgmentally viewed the assortment of materials related to the project aim is problematic. As

an investigator, I had to select some of the literature and ignore others. To be more specific, I

will reference Yuanzhuo Wang, (09 September 2015) that describes the game-theoretic method

as a tool that can predicts buying behaviours up to 70%. The material is investigated only for

personal awareness and is not appropriate for the aim of this project. The reason is that the game

theoretic method is related to the social websites, where the objective of the project is to con-

sider approaches, which are associated with the small retail businesses. The value of being

Page 23: Project 10.07.16 FINAL EDIT PDF

12

aware of the game theoretic method is the opportunity to relate the findings with the other out-

comes from the study.

Google corporation is acknowledged as a leader in developing advanced applications. “Google

Prediction API” is the example of this set which distributes pattern-matching capabilities

(Google Cloud Platform, 19 August 2016). With predictive models and user’s history of buying

products, developers can predict future products that a customer might like. Prediction API

models could help businesses to classify e-mails as spam or non-spam (Agrawal, 18 March

2013). Example: With gmail.com the e-mails are automatically categorised; eBay application

has the capability to estimate the effect of posted comments and define them as positive or

negative (Dorard, 2014). Following my objectives by using the predictive application the small

retail businesses will be able to presume how much could cost a bottle of wine at certain day

by using the information of the previous history of wine sales.

In the review of Machine Learning Casalboni, (12 May 2015) states that the most suitable way

of using machine learning algorithms is in “black box” mode. To develop the application, which

will be delivered to the small retail businesses in the United Kingdom, I need to be aware of the

possible outcomes from the algorithms and need to use adequate resources. The method is ac-

ceptable for offline testing because I will be able to appraise the correctness of predictions.

Furthermore, Prediction API is an excellent option and does not need any infrastructure.

The following authors Tian, T., Ae Chun, S., and Geller, G., (2011) declare that a prediction

model for web search hit counts by using word frequencies. The discoveries are based on the

use of Google Prediction API as a search engine. Tian Tian, (ibid., 2011) defines that users can

find accurate and relevant data, based on their search purposes within a few hits. Critically

viewed, trying to find useful links or research papers in google.com could result in hundreds or

even thousands of articles. The authors offer query rewriting methods for producing different

query strings. Tian, Tian (ibid., 2011) provide evaluation testing of the hit count prediction

Page 24: Project 10.07.16 FINAL EDIT PDF

13

model for the search engines such as Google and Bing. The method illustrated by the authors

is a clear example of how the implementation of Prediction API search engine could result in

better user experience while buying goods.

“Prediction of Consumer Purchase Decision using Demographic Variables: A Study concerning

Premium Car” is a journal provided by Kumar, S., (2013) appropriate for the aim of my

investigation because the author investigates different aspects of how Prediction API models

can be implemented efficiently. Small retail businesses are following certain rules to satisfy

their customers by providing products based on individuals needs and desires. In the review of

the document Kumar, S., (ibid., 2013) evaluates how organizations distinguish their goods

related to the lifestyle, age, education…etc. Also, the author provides information about how

premium vehicle holders in Chennai city use Prediction APIs and the ways of predicting the

consumer’s decision to buy an individual product. The example has been used to understand

the ways of targeting a group and developing a marketing strategy for prediction of customer’s

intention.

Furthermore, H. Onur Bodur, (22 March 2014) presents the topic “Will You Purchase

Environmentally Friendly Products? Using Prediction Requests to Increase Choice of

Sustainable Products” which is related to commitment-based interventions. According to H.

Onur Bodur, (ibid., 2014) the commitment-based paternalism is the most appropriate approach

for inspiring environmental behaviours. The example mentioned by the author delivers a clear

understanding of how Prediction Requests usage leads to an efficient mass communication

strategy and impact behaviour among a huge audience. To gather data for any investigation,

individuals must investigate materials from a significant number of websites, online published

documentation, and video tutorials, which is time-consuming and most of the time inaccurate.

H. Onur Bodur, (ibid., 2014) declares that by using his approach individuals will be able to

gather a lot of evidence and see the effectiveness of prediction requests method.

Page 25: Project 10.07.16 FINAL EDIT PDF

14

Following the aim of the project for the efficient development of the predictive application, I

had to implement a simple programming script. In the review of programming languages Barry,

P., (2010) provides examples of simple programming scripts required for the development of

Google Prediction API and also explains how most of APIs are build. Similarly, Dorard, (2014),

Cloud Academy, (2016), Agrawal, (18 March 2013), Brownlee, (2016) and Google Cloud

Platform, (2016) have also examined the ways of developing Prediction API models and their

implementation.

Another beneficial journal is “How to Use Google’s Prediction API to Dig into AdWords”

written by Brennan, M., (2015). The author states that machine learning can enhance the results

when the information is added and expand predictions based on the response of the participants.

Brennan, M., (ibid., 2015) introduces different API learning algorithms and the ways of how

the data can be analysed.

Through the research process, I had the chance to participate in a blog where Casalboni, A.,

(2015) offers guidance which delivers a better understanding of using the predictive application

via the RESTful interface and also I had the opportunity to get experienced with the software

available on the Google Cloud Platform.

The Cloud Academy, (2016) delivers excellent sources of information, because of training

courses, provides video tutorials and documentation necessary for beginners who are ready to

get involved in the process of development applications.

Again Brennan, (27 May 2015) identifies different approaches of the Google API keys for

success and also delivers material of what are APIs and how they work. According to the

purpose of this project, I was able to relate the strategies to the dissertation aims and objectives.

Page 26: Project 10.07.16 FINAL EDIT PDF

15

Also, Ohri, (30 July 2012) evaluates cases that have been already implemented Prediction API

and describes the Purchase Prediction model as a tool which increases customer’s satisfaction

by efficient use of it. The examples are:

The giant tech companies such as Google, Yahoo, and Microsoft use Machine Learning widely

to achieve tasks that involve intelligence on a huge scale. They provide personalized content to

each visitor to their web pages by predicting what could engage each of the users. Facebook

gives examples of data that we could be interested. To be more specific this could be different

articles or people that we might know, also after selecting a photo, the app scans the image for

faces, and we can tag the person whose face appears on the picture.

One of the video tutorials provided by Doraisamy, (30 October 2014) is based on how Google

Prediction APIs help businesses to deliver better customer service. The author associates user’s

intelligence and software as a service (SaaS) which are quite related. Doraisamy, (ibid., 2014)

delivers information of how Google APIs understand user’s intention by typing into the browser

a few keywords. On the other hand, QVSource, (25 September 2013) provides a guidance of

how to create a training data and implement Google Prediction models by using QlikView and

QVSource. It is a great option for getting experienced with prediction models if you are not

quite experienced. By using QlikView and QVSource individuals can create a sentiment

prediction model on the Google Prediction Connector. Examples are:

- Email classification

- Spam Detection

- Language Detection

The author provides examples of how the training data should look like and the steps of

uploading the dataset. By using a user’s past viewing habits, developers can analyse user’s

feedbacks and determine if they have a positive or negative impact. Critically viewed the

Page 27: Project 10.07.16 FINAL EDIT PDF

16

examples provided by Doraisamy, (30 October 2014) and QVSource, (25 September 2013) are

not going to be used for the purpose of this project. They require an investment for the efficient

use of the sources, but the information will help me to understand the concepts of implementing

Prediction API within the business.

2.3.1 Ubiquity

The aptitude of individuals to obtain data from any location whenever they want and also to

perform transactions refers to ubiquity (Clarke, I., 2001). According to the project, mobile

phones are an excellent example of universality which is the reason to decide to develop a

mobile application that could deliver easy access to the information gathered from predictions.

With the cell phones, individuals can reach any application by connecting to the internet

(Richard T. Watson, September 2002). Small retail businesses can implement mobile device

capability to be universal while offering goods that are related to the customer expectations.

Chapter 3: Technical Research

3.1 GOOGLE CLOUD PLATFORM FEATURES AND PREDICTION API MODELS

3.1.1 Comparison between Google Cloud Platform, Amazon Machine Learning,

Azure Machine Learning

To provide the reasons for choosing Google Prediction API models in Google Cloud Platform,

I had to explain the difference between Amazon Machine Learning, Azure Machine Learning,

and Google Cloud Platform.

Page 28: Project 10.07.16 FINAL EDIT PDF

17

Amazon ML and Azure ML are relative newcomers in the cloud-based market while Google

Cloud Platform has been released in 2011 and offers more stable and secure way to get experi-

enced with Machine Learning models (Robust, 14 April 2015).

The industry of the Machine Learning continues to grow, and numerous tools have been devel-

oped to provide access to advanced learning algorithms with a minimal effort. The approach

“feed in data, get an answer back” it’s a great option for businesses to implement Machine

Learning solutions (Almeida, 12 May 2015). The reason for choosing Machine Learning ap-

proach is that the tools are built by some of the best experts in the ML field.

The services that have been investigated in this research paper are Amazon Machine Learning

service, Microsoft Machine Learning Studio, and Google Machine Learning solution. I am fo-

cusing on the service functionalities, and I will cover the uploading of the data. To be able to

perform the tests, I had to use the services’ consoles. The summary below delivers the aspects

of data sourcing and what should be considered when individuals are choosing a service:

- Data sources.

- Formats

- The maximum size of the data types.

Amazon Machine Learning:

- Data sources: The text file needs to be uploaded into S3; AWS RDS; AWS Redshift;

AWS S3 table.

- Data formats: CSV file; S3 or Redshift database.

- Dataset maximum size 100GB.

- Data types: Boolean; categorical; numeric; string.

Page 29: Project 10.07.16 FINAL EDIT PDF

18

- AWS supports the major dataset for batch training.

Microsoft Azure Machine Learning

- Data sources: The file needs to be uploaded in Azure Storage. It could be SQL database;

web URL; Hadoop HiveQL.

- Data formats: CSV and txt files; Hive/ SQL tables; OData values; zip; RData.

- Dataset maximum size 10GB.

- Data types: Boolean; categorical; date time; numeric; string; timespan.

- Microsoft Azure has the broadest variation of data sources and formats.

Google Cloud Platform

- Data sources: The text file needs to be uploaded into Google Storage; Google

spreadsheets; HTTPS requests; API update calls.

- Data formats: txt file; spreadsheets; JSON.

- Dataset maximum size: text file should be maximum 2.5GB; HTTP request is maximum

2MB.

- Data types: Numeric; String.

I need to mention that both AWS and MS Azure can read data from tables uploaded in their

storage services. From my point of view, the MS Azure provides flexibility for the data sourcing

and data processing, but Google provides the key feature in ML applications. As I have men-

tioned before individuals, get access to incremental training and also allows the use of virtually

Page 30: Project 10.07.16 FINAL EDIT PDF

19

infinite data. Finally, Amazon ML data processing capabilities are in between the other two;

there are some functionalities, but not too many.

According to the project aim, the models could be trained on uploaded text files with all types

of services, but the reason to choose Prediction API within Google is that the platform supports

update calls, which means by adding more information I could send more requests to the same

training model. Also, Google Cloud Platform offers a free trial version which has been used for

the purpose of this project. I had to sign up by using my Google account which allows me to

use the models and get maximum 100 predictions per day for the period of six months. Critically

viewed the internet connection is crucial for the efficient use of the models. The data is kept in

the Google cloud storage, and there are no restrictions on the amount of the data uploaded

within the project.

3.1.2 Prediction API models

The Machine Learning algorithm consist the following two algorithms: a training algorithm and

a prediction algorithm.

• The training algorithm involves learning a model from examples (data). The training algo-

rithm is also known as learning algorithm and takes a set of input-output models, or training

dataset, and generates a model by examining this dataset (Dorard, 2014).

• A prediction algorithm uses the training model and a new input and delivers an output value.

To be more specific, we make a prediction of an output based on a given input (data) against a

model, Fig. 2.

Page 31: Project 10.07.16 FINAL EDIT PDF

20

Figure 2: Prediction process (Dorard, L., 2014)

3.2 ANDROID AND APPSHEET MOBILE OPERATING SYSTEMS

Nowadays the mobile applications are increasing their complex capabilities which lead to the

variability of platforms and operating systems accessibility. All of us are using a variety of

mobile software such as internet browsers, games, videos which make us linked to the phones.

The reason is the design of the application if it meets our requirements we will install the app.

The assortment of features, processing speed, user interface, and the existing applications

depend on the operational system of the given device (Studio, 2016).

3.2.1 Android

“Android is an open source software stack that includes the operating system, the middleware,

the main applications and a range of API libraries used for developing applications to determine

the design of the mobile handset” Meier, R., (2009) and also provisions ordinary hardware cell

phones. According to Meier, R., (ibid., 2009) Android provides free mobile software fulfilment

for the developers and handset builders. To be more specific, the Android was developed by

Google in 2005 and is maintained by the Open Handset Alliance which involves more than 30

Page 32: Project 10.07.16 FINAL EDIT PDF

21

firms together with hardware constructors, software developers and mobile carriers who work

organized and deliver software satisfaction.

“Android incorporates a Linux kernel that is taking care of the primary services such as the

memory and power management process, security and the network. The kernel also provides

an abstraction layer between the hardware and the stack remains”, Ahmad and Khan (2013).

To develop applications users, need to use Java programming language, but the requests are

executed by the usage of Dalvik VM which ensures efficiency. According to Parida, A., (2013)

the Dalvik virtual machine is built to transform the classes of Java language into a bytecode

interpretation-machine code commands.

Wagoner, A., (2016) claims that the original version of Google Play was Google’s Android

applications market, where individuals could download diverse Android applications

appropriate for any devices.

The most vital problem concerning the Android devices is disintegration. Some Android

operational systems that possess user requirements are not well-suited with other versions of

Android OS. In this situation, an Android device can be executed on previous types of Android

OS, but cannot update information while running on the newest ones which are a problem when

developers need to design an Android application. The inventers need to be more cautious

during the development procedure and certify the capability with the previous versions of the

operational system, dissimilar sizes of the screen, input gestures, etc. (Vassallo, E., 2014).

According to the aim of this project and the decision of using Google services, I have to mention

that Google made changes to avoid problems with the fragmentation (ibid., 2014). Google Play

turn out to be more important than the operation system necessities when developing an

application. The Google Play store is used for copying the main services that are essential to

execute applications on an Android device. The important Android features and the application

Page 33: Project 10.07.16 FINAL EDIT PDF

22

fundamentals are taken from the operating system to the Google Play store to guarantee that the

requests could be executed with the new features and applied in all types of devices (ibid.,

2014).

3.2.2 Use of Google Cloud console and Prediction models for the AppSheet appli-

cation

To develop a mobile application on an AppSheet platform is used Google Cloud Console that

permits a smooth execution and customization of the predictive models with the application.

Prediction API is kept in Google Cloud platform and permits users to experience several models

of a certain area by training the dataset uploaded to the website (Console, 2016). For the

connection, API key is essential; it is free, and it can be used by many people (Google Cloud

Platform, 2016). It is regularly updated and worldwide supported. The benefit is that Google is

responsible for the maintenance of it. The application development will be explained in Chapter

5 and Chapter 6.

3.2.3 AppSheet

AppSheet is a platform which does not require coding skills and competencies and the platform

could be used by everyone for free. It is a business productivity solution which provides a con-

tent display, note-taking, different forms and workflow for business scenarios (Play, 2016).

Users can develop applications by converting Google spreadsheets into mobile apps. With the

AppSheet everyone can create and deploy mobile solutions for any business based on the data

uploaded in the Google Sheets (Sphon, 25 January 2016).

The reason for choosing AppSheet for the development my application is because does not

require any coding skills, it is an easy solution to develop applications, and there are no hidden

Page 34: Project 10.07.16 FINAL EDIT PDF

23

costs. To be more precise for the aim of this project, the AppSheet will use the data from my

Google spreadsheet and display the outcomes generated from prediction models in an interac-

tive way through the AppSheet mobile app.

3.2.3.1 Google Spreadsheets

I have mentioned that for the purpose of this project is going to be used a Google spreadsheet

which is a web-based application that delivers options to modify spreadsheets, to create new

ones, to update old information and share the data online (Rouse, 2016).

The programme is Ajax-based and is well-matched with CSV files which represent comma-

separated values and Microsoft Excel. Google’s product delivers features which are typical for

spreadsheets. Examples are the aptitude to add columns, delete columns and manage rows. One

of the facts is that a beta version of Google Spreadsheets was offered to Google subscribers in

June 2006 which offer lightweight (ibid., 2016). The dataset related to the spreadsheet used for

the application development will be provided in Chapter 4.

3.2.4 Comparison between AppSheet and Android developments of application

3.2.4.1 AppSheet applications

The AppSheet application enables numerous, geographically isolated operators to cooperate in

real-time and chat over a built-in instant messaging program while working on a spreadsheet.

Individuals can upload spreadsheets straight from their computers. AppSheet is a good solution

for more than a few scenarios, such as:

- Working with remote teams where the uploaded Spreadsheets in Google Drive are

connected with the remote users via the AppSheet App. The remote users can access the

Page 35: Project 10.07.16 FINAL EDIT PDF

24

data in simplified ways and add, edit or delete information to complete the workflow

(Play, 2016).

- Project Management: People over the world manage their projects over Google Sheets.

To be more specific, project managers use AppSheet to display and share data by a

mobile device with other team players and stakeholders. Through the settings, the data

could be centralized in a core spreadsheet and displayed only for a particular audience

(ibid., 2016).

According to the purpose of the project the AppSheet offers a solution for Customer Engage-

ment where small retail businesses in the United Kingdom can keep track of business pipeline

on a Google Sheet. Another benefit is that the data could be accessed through the AppSheet for

an enhanced and streamlined view (Rouse, 2016). Examples are building catalogues using im-

age galleries (wine samples and prices) to keep the customers updated with recent offers or

sending emails to contracts recorded in the spreadsheet.

3.2.4.2 Android Applications

Nowadays, the mobile applications have a significant influence on the everyday life. While

developing the application, few factors need to be considered such as device functionality,

security, offline capability. To investigate which is the most appropriate type of the application

for my project, I had to mention the following types of applications – native, web and hybrid

one (Saccomani, P., 2012).

The developers who are using a particular platform such as Android must develop a Native

application due to the usage of all available device features. As we know, the applications could

be reached via device icons and downloaded from an Android app store called Google Play. To

be more specific, the native applications have a range of touch features such as double taps, UI

Page 36: Project 10.07.16 FINAL EDIT PDF

25

gestures, fast API graphics, which are highly essential for playing games and producing

interactive reports.

Native applications require highly relevant programming background which makes them more

complicated compared to the AppSheet applications because they necessitate highly relevant

programming skills. According to Korf, M., Oksman, E., (2015), the application is active

immediately, performs fast and possesses a consistent look.

Mobile web applications could be explained as a collection of web pages, which are executed

within a mobile browser. The programming languages that could be used are HTML5,

JavaScript, and CSS. The process of building cross-platform mobile applications entitles

HTML5 programming language which allows the bug to be fixed easily together with the

operation of adding features and positioned to the final users. In comparison, AppSheet

applications do not require any coding skills and competencies.

The grouping between native and web application form the third category of applications named

hybrid. To be more specific, the HTML application is placed in a native container, for example,

Adobe PhoneGap. The benefit of using Hybrid applications relates to the application usage on

dissimilar platforms with no further development effort and cost (ibid., 2015), Fig. 3.

Page 37: Project 10.07.16 FINAL EDIT PDF

26

Figure 3: Native, HTML5, or Hybrid (Korf, M, and Oksman, E., 2015)

It seems that both development platforms deliver some welfares and disadvantages. Based on

the application interface appearance, hybrid applications require HTML5 and CSS3 to provide

additional adaptive and lively content. However, the native applications contain tools used for

the design creation of the native interface together with user collaboration involvement that is

not accessible for hybrid applications.

To summarise for the purpose of the project, AppSheet application development solution is

used instead of Android development environment. It is free of charge to develop mobile ap-

plications by using AppSheet development technology because it delivers tools and options that

reduce the development time. Also, the AppSheet applications could be executed on any mobile

platform (iPhone, Android, Windows) and it does not require coding.

Page 38: Project 10.07.16 FINAL EDIT PDF

27

Chapter 4: Research Design and Methodology

4.1 RESEARCH APPROACHES

According to the purpose of the project, two approaches can be differentiated: deductive and

inductive. The deductive approach could be explained as the developing of a concept and hy-

pothesis observed and measured to approve the idea (Alan Bryman, 2008). Also, Altinay and

Paraskevas (2008) emphasize that a deductive method is used to clarify the connection that

occurs among the variables under observation. Furthermore, Swanson and Holton (2005) states

that deductive method involves time-consuming and requires a good understanding of the topic

under the investigation.

However, in an inductive approach (Alan Bryman, 2008) states that is necessary to avoid spe-

cific observations and choose wider overviews and concepts. According to Creswell (2000), a

few practical criteria’s can support the result concerning the proper research utilization of the

approaches. Furthermore, it is designated that selecting a topic which is relatively new and there

is a lack of literature related to it, is better to apply an inductive approach for generating infor-

mation which could be analyzed for the possible themes. Thus, concerning that the project is

focused on Prediction API models which are relatively new, and there is a lack of extensive

literature, I had to build up the application based on existing theory to the mobile applications

in developing companies.

To summarize the use of the above research approaches, I will relate the research questions

with the inductive and deductive approach.

- What are the current predictive technologies? Objective one: The investigation is

conducted in inductive approach where has been collected a relevant data to the project

aim.

Page 39: Project 10.07.16 FINAL EDIT PDF

28

- How can Google Prediction API be used to develop a decision-making application?

Objective one: The information is gathered by applying the inductive approach. I have

made several observations, and then the information from the literature review has been

used to deliver a more general set of propositions.

- What is the outcome of implementing the Google Prediction API into the small retail

businesses in the United Kingdom? The second objective is related to this question and

has been examined by applying deductive approach. I have decided to move from a

more general level to the specific one. I have investigated how other individuals are

using Prediction API and how they applied the models to the particular case. This has

been conceivable by using the documentation published in the Google Cloud Platform

(Google Cloud Platform, 2016).

- How Predictive application could be utilized as a strategic tool to achieve business

objectives? The third objective has been examined by using the deductive approach.

Where the review of documentary published by (Gaur, 20 April 16), (Green, 10 May

2011), (Irani, 29 March 2016), (Mombrea, 29 September 2011) and (Pathak, 15

December 2015) deliver the necessary key steps of using predictive applications.

4.2 RESEARCH STRATEGY

According to Saunders (2009), there are different research strategies which could be used to-

gether.

Page 40: Project 10.07.16 FINAL EDIT PDF

29

4.3 EXPLORATORY AND EXPLANATORY RESEARCH STRATEGIES

For the purpose of this project have been used an exploratory and explanatory research strate-

gies which exclude the descriptive research approach for the following reason.

The descriptive investigation intention is “to portray an accurate profile of the person, events,

and situations” (Robson, 2002), and it does not appear to be the suitable method of choice for

this project. According to Saunders (2009) the explanatory research “establishes causal rela-

tionships between variables”. A causal research characterizes the affiliation between variables

such as predicting the impact of value on sales (Coldwell and Herbst, 2004) and is more appro-

priate to the experimental form and the purpose of this project (Hakim, 2000).

The exploratory research strategy is used to clarify unclear problems and depends on qualitative

methods to expand the understanding of the research problem (Hair, 2011). In fact, the purpose

of the dissertation relies on facts and figures, which forms the project aim.

4.4 CASE STUDY

For the achievement of the project objectives, the research has been conducted by implementing

a case study strategy. To be more specific by following this approach I will be able to conduct

an in-depth investigation of a particular present-day subject which in my case is Prediction API

implementation within the business. The reason for implementing a case study method is to be

aware of the social context of the subject matter which is essential to understand the observable

facts (Alan Bryman, 2008). According to Yin (2009), the case study strategy is the most suitable

way to represent a unique topic. Following the aim of this project which is to developing an

application by using Prediction API models are considered that case study strategy is the most

suitable way for the achievement of the project objectives. The additional reasons for this choice

are clarified in section 4.5.

Page 41: Project 10.07.16 FINAL EDIT PDF

30

4.5 DATA COLLECTION METHODS

4.5.1 Primary and Secondary Data

Secondary sources are the data that has been already gathered and is readily accessible from

other sources (Saunders, 2009). With regards to the secondary data used in this project, there is

a lack of wide-ranging literature according to the Prediction API implementation in the United

Kingdom which impacts the ability to determine any assumptions on the research objectives.

Primary sources are the data collected by the researcher for the purpose of the dissertation (ibid.,

2009). Critically viewed collection of primary data requires a lot of time and user’s participa-

tion, this is the reason of using secondary data mainly for the project. The secondary research

offers the most suitable approach to exposure the research objectives which delivers already

proven investigation methods.

4.5.2 Google Spreadsheet Dataset

The spreadsheet dataset used for the application development is shown in Fig. 4.

Figure 4: Google Spreadsheet dataset used for the purpose of the project (docs.google.com, 2016)

Page 42: Project 10.07.16 FINAL EDIT PDF

31

The purpose of using Google spreadsheet within AppSheet is to represent pricing optimization.

To be more specific, the following information will deliver a clear view of what about is the

spreadsheet. The spreadsheet is orientated to the small retail shops based in the United King-

dom.

- Description: The spreadsheet includes information about new wine products within an

existing category of wine products that have been sold, and the aim is to predict how

small retail businesses should price the new bottle of wines.

- Question asked: "What should be the price of the new bottles of wine.

- The type of the Machine Learning problem is Regression. The regression is a statistical

method for assessing the relationships between variables.

- Input: Wine products.

- Features: Information about each of the wine products such as region, rating, the type

of grapes, year of production, brand and sales price.

- Output: Price.

- Data collection: The small retail businesses needs to log the amount every time a prod-

uct of the same category has been sold.

- How predictions are used: Small retail businesses need to set the price of each wine

product to the value provided by the predictive model. As we know the prices are likely

to change over time and the benefit of using Google Prediction models is that the data

could frequently be updated with new information.

Page 43: Project 10.07.16 FINAL EDIT PDF

32

4.6 STRENGTH OF METHODOLOGY

The key advantage of the methodology is the evidence of overall findings of the Prediction

application development and implementation which have been achieved by using the induc-

tive and deductive approaches. The essential part of this project is to understand the impact of

implementing Prediction application on small retail businesses in the United Kingdom where

the deductive approach allows me to deliver outcomes which are straight to the point.

4.7 LIMITATIONS OF METHODOLOGY

However, regardless of the advantages deliberated above the methodology also has several dis-

advantages. According to (Jordan, 2016), the main problem of the inductive method is related

to the project observations. Jordan (ibid., 2016) states that few observations are not enough for

valid conclusions. The investigation process needs to be continued for sufficient results. Also,

this methodology has a tendency to be more problematic regarding investigating the develop-

ment process of Prediction application. An additional disadvantage of this investigation is re-

lated to the process of application development. As an inexperienced investigator, this may

negatively influence the project design.

4.8 ETHICS CONSIDERATIONS

According to (Blumberg, 2005), the ethics are related to the moral principles that administer a

user’s behavior and relationships with others. Ethics are linked with the collection of the pri-

mary data regarding the rights of the contributors. The purpose of the ethics consideration is to

ensure that contributors are not going to be harmed or suffer from adverse consequences during

the research process (ibid., 2005). Also, the ethics such as privacy and liability of the researcher

Page 44: Project 10.07.16 FINAL EDIT PDF

33

are considered. Thus, to avoid any ethical issues, the primary goals of the subject matter were

clearly clarified, and the information used for this project is entirely based on secondary re-

sources.

Chapter 5: Prediction API models embedded in Google Spreadsheets

and Data Analysis (Development overview)

5.1 FETCHING DATA

- Google Spreadsheets

By using Microsoft Excel, Open Office Calc or Google Spreadsheets, we can save our dataset

as a CSV file. There is a tutorial by (Dorard, 2014) which explains how to set up the google

spreadsheet and use Google Prediction API models. Another example of how to upload and

create dataset file could be found in Google Cloud Documentation (Google Cloud Platform,

2016).

In the tutorial provided by (Sphon, 25 January 2016) are exposed the steps of using Google

spreadsheet within an app. To create the Google spreadsheet for the purpose of this project, I

had to use docs.google.com and click on new>>create a sheet, Fig. 5.

Page 45: Project 10.07.16 FINAL EDIT PDF

34

Figure 5: Screenshot of the Google Spreadsheet development process (docs.google.com, 2016)

It looks like an excel document but how we use it? The spreadsheet view is a set of data which

have the same structure as a spreadsheet program (Dorard, 2014). Each component of the da-

taset is an item that is stored in a row, and each column characterises a feature or attribute of

that item. The columns deliver information about the items and their description. The benefit

of using Prediction APIs is that we can predict the values of missing features or attributes. In

our case, the missing values are shown in the following figure from cell 20B to cell 27B which

needs to be predicted by using the prediction models, Fig. 6.

Page 46: Project 10.07.16 FINAL EDIT PDF

35

Figure 6: Dataset, missing values from cell 20B to cell 27B required for predictions (docs.google.com, 2016)

The wine features explained in Chapter 4 represent information about each of the wine products

such as region, rating, the type of grapes, year of production, brand and sales price.

Within Machine Learning we can pick only one attribute on at a time to make predictions

(Brownlee, 2016). To be more specific our first column in the spreadsheet has been chosen on

which to make predictions and is our Prices outcome. If there is a gap in other columns, I need

to develop a different model for each column. The cost of the feature or attribute that I want to

predict becomes the output of the machine learning issue, and the other features are the input

components (Dorard, 2014). Each feature characterises a piece of data that has an effect on the

outputs which will be predicted. The type of grape, year of production, wine brand are features

that have a significant impact on the price of a specific bottle of wine.

Prediction API models can be used to predict missing values of the data. Here I had to insert

outputs which are going to be wine prices and inputs are the wine features. The reason for

Page 47: Project 10.07.16 FINAL EDIT PDF

36

choosing wine product examples is to predict numerical outputs which will be continuous and

real-valued.

According to (ibid., 2014) prediction of real-valued numbers is called regression. The data used

for the purpose of the project is based on regression and predicts wine sale prices. The input is

some wine attributes shown in the spreadsheet. During the development process of the web

application and using of the Prediction API models, I had to create a Google account, to be able

to access the embedded models and the Google storage from anywhere at any time.

According to the aim of the project for the developing of the application, I am using Google

spreadsheet and Prediction API models. In comparison, Google Cloud Console provides easy

access to predictive models but requires Android Studio installation to develop the application

for the business use.

5.2 INITIAL STATE

Google Cloud Platform guides the users with information about how Prediction API models

could be used (Google Cloud Platform, 19 August 2016). In the Quickstart documentation is

explained step-by-step how to create a project within the Google Cloud Console and how to

upload the training dataset to produce real-time values or obtain results.

The Initial State of the project is related to this guidance since it uses examples of how to use

Google Cloud Platform and its services. The information provided in the documentation helps

of non-experienced developers to get a clear view of what results could be generated by using

Prediction API models. The document also explains different scenarios of predictions such as

language detection, email classifications, and purchase predictions.

Page 48: Project 10.07.16 FINAL EDIT PDF

37

The alteration between the Initial State guidance and the work obtainable in this project is that

the dissertation is mainly concerned with the making of predictions and presenting real-time

values related to the small retail businesses in the United Kingdom, and also the information

used for those predictions is based on previous purchase history. According to the purpose of

the research, the small retail businesses founded in the United Kingdom will be able to predict

the possible cost of the wine products.

To use Prediction API, I had to create a project in the Google Cloud Console and enable the

billing for the project. Google Cloud Platform offers a free trial version for the first six months

which allow individuals to get experienced with Cloud services and train their models without

any charges (Google Cloud Platform, 19 August 2016). The steps are as follows:

- Go to the Projects page.

- Click on CREATE PROJECT, choose a name and click CREATE, Fig. 7.

Figure 7: Project development: Name selection process (cloud.google.com, 2016)

I have received the following, by selecting WINE as a name of my project, Fig. 8:

Page 49: Project 10.07.16 FINAL EDIT PDF

38

Figure 8: First stage of the project development (cloud.google.com, 2016)

- On the right site of the top corner I had to enable the Prediction API and Google Cloud

Storage APIs for the project by clicking on Enable and manage APIs, Fig. 9.

Figure 9: Google APIs selection options (cloud.google.com, 2016)

Page 50: Project 10.07.16 FINAL EDIT PDF

39

- The next step is to click on Google Cloud APIs and choose Prediction API, Fig. 10.

Figure 10: Prediction API selection (cloud.google.com, 2016)

- To enable Prediction API, I had to press the button ENABLE, Fig. 11.

Figure 11: Enabling of Prediction API (cloud.google.com, 2016)

Page 51: Project 10.07.16 FINAL EDIT PDF

40

- Because I will use the APIs Explorer, there is no need to go to the Credentials page

afterward. At the bottom, individuals can choose TRY THIS API IN APIs EXPLORER

which is my decision, Fig. 12.

Figure 12: “Try this API in APIs Explorer”: link (cloud.google.com, 2016)

Figure 13: Prediction API training models (cloud.google.com, 2016)

Page 52: Project 10.07.16 FINAL EDIT PDF

41

- From here I can choose the training model required for the purpose of my project, Fig.

13.

To be more specific, the model that will be used is prediction.trainedmodels.insert to

(or “intending to”) training my dataset, but before that, I have to enable the Google

Cloud Storage and upload my training data.

- In the Google Cloud Platform, I had to click on the Create a Cloud Storage bucket and

choose a name, then click on Create, Fig. 14.

Figure 14: Cloud Storage bucket formation (cloud.google.com, 2016)

The name of my bucket is purwine which could be seen in the following picture, Fig.

15. The training dataset has been uploaded by selecting UPLOAD FILES.

Page 53: Project 10.07.16 FINAL EDIT PDF

42

Figure 15: Uploading of the training dataset (cloud.google.com, 2016)

The following information is essential to use prediction.trained.model.

- To train the model, I had to call the method and provide the ID of my project which

could be found on the Home Page or Google Cloud Console and also to provide the

location of my training data (Cloud Platform Console Help, 2016). The project number

is automatically generated once the project is created and is used only within the

console. The project ID cannot be changed after the project is created. Project details:

- Project ID: wine-1357

- Project number: 233110773272

- Purwine/purchase.txt

By entering the requested information into the empty fields, I was able to use prediction.trained-

models.insert which is associated with the dataset uploaded in Google Cloud Storage, Fig. 16.

Page 54: Project 10.07.16 FINAL EDIT PDF

43

Figure 16: Execution process of prediction.trainedmodels.insert (cloud.google.com, 2016)

After executing the file, I have received the following message that my request has been re-

ceived, and the response provides information, which there are no errors, Fig. 17.

Figure 17: Prediction.trainedmodels.insert request and response (cloud.google.com, 2016)

Page 55: Project 10.07.16 FINAL EDIT PDF

44

The next step is to execute the prediction.trainedmodels.get and use the training data, Fig. 18.

The system requires the project ID before execution.

Figure 18: Prediction.trainedmodels.get execution process (cloud.google.com, 2016)

Once the details are provided and execution is done, I have received a message that the request

has been sent successfully and in the response does not appear any errors, Fig. 19.

Figure 19: Prediction.trainedmodels.get request and response (cloud.google.com, 2016)

Page 56: Project 10.07.16 FINAL EDIT PDF

45

The final step is to execute the prediction.trainedmodels.predict to receive the final results,

Fig. 20.

Figure 20: Prediction.trainedmodels.predict execution process (cloud.google.com, 2016)

Figure 21: Prediction.trainedmodels.predict request (cloud.google.com, 2016)

The final results are as follows, Fig. 22.

Page 57: Project 10.07.16 FINAL EDIT PDF

46

Figure 22: Prediction.trainedmodels.predict responses (cloud.google.com, 2016)

Because the results from the models embedded in the Google Cloud Console are not clear, I

had to use the google spreadsheet mentioned above. The entire process is explained in the fol-

lowing chapter.

Chapter 6: Implementation of Prediction API models within Google

Spreadsheet and testing of the mobile application

6.1 GOOGLE APP SCRIPTS

Google App Scripts is a silver platform to write and run scripts on Google’s infrastructure. This

scripts can access your data on Google services, they can read and write data, and they can also

make you easily soft with the Google Prediction APIs. We need, to begin with very basic script

that access’s my data on Google documents. And then I need to integrate Google app scripts

Page 58: Project 10.07.16 FINAL EDIT PDF

47

with a google spreadsheet to make use of Google Prediction API and predict the missing values

of the spreadsheet. Let’s get started first we go to script.google.com, Fig. 23.

Figure 23: Google App Scripts platform (script.google.com, 2016)

By selecting Start Scripting, I will create my project. Then I need to enter my basic script, Fig.

24.

Figure 24: Basic script used for the purpose of the project (script.google.com, 2016)

Page 59: Project 10.07.16 FINAL EDIT PDF

48

The script creates a document using the documentsapp API, and the name of the document is

my test document. Then we go through the loop and in each situation we do two things: we add

a paragraph that is called heading plus the number of iteration and we set (DocumentApp,Par-

agraphHeading,HEADING) to be a HEADING of level 2. Then we add a simple paragraph

called paragraph and the number of iteration. Save as “my basic script”, Fig. 25.

Figure 25: Edit Project Name screenshot (script.google.com, 2016)

Once is saved we can run the main function, Fig. 26.

Figure 26: Execution of the main function (script.google.com, 2016)

Page 60: Project 10.07.16 FINAL EDIT PDF

49

And then we need to give permission to access the google drive content, Fig. 27.

Figure 27: Google Drive access request (script.google.com, 2016)

And finish with pressing Allow.

I need to check the console logs, Fig. 28 and make sure that everything runs without any errors.

Page 61: Project 10.07.16 FINAL EDIT PDF

50

Figure 28: Checking of the Console Logs (script.google.com, 2016)

In Google Drive, I can see my basic script that has been created, Fig. 29.

Figure 29: Evidence of “my basic script” and “my test document” files uploaded in the Google Drive (drive.google.com, 2016)

By clicking on my test document, I can see that replies as expected, Fig. 30.

Page 62: Project 10.07.16 FINAL EDIT PDF

51

Figure 30: “my test document” content (docs.google.com, 2016)

The next step is to create spreadsheet document with my training data. The scripts associated

with the spreadsheet are developed by (Dorard, 2014). By using his digital package, I was able

to understand the meaning of Prediction API and the process of developing Google spread-

sheets, Fig. 31.

Page 63: Project 10.07.16 FINAL EDIT PDF

52

Figure 31: Prediction Google Spreadsheet (docs.google.com, 2016)

The name of my document is Prediction. Once the document is created, I had to enable Predic-

tion API. For this, we go to Tools click on script editor, and this opens the google app script

associated with this spreadsheet, Fig. 32, Fig. 33, Fig. 34, Fig. 35.

Figure 32: Google App Script associated with the spreadsheet (docs.google.com, 2016)

Page 64: Project 10.07.16 FINAL EDIT PDF

53

Figure 33: Google App Script associated with the spreadsheet (docs.google.com, 2016)

Figure 34: Google App Script associated with the spreadsheet (docs.google.com, 2016)

Page 65: Project 10.07.16 FINAL EDIT PDF

54

Figure 35: Google App Script associated with the spreadsheet (docs.google.com, 2016)

The code above is associated with the spreadsheet used for the purpose of this project. There

are three files where the first contain the actual code specific to the Prediction API. The second

file contains the help functions, and the third file contains methods that access the values stored

in the spreadsheet and reads them or face them in.

For the purpose of this project I had to activate the Prediction API, this could be done be se-

lecting RESOURCES and click on advanced Google services, Fig. 36.

Page 66: Project 10.07.16 FINAL EDIT PDF

55

Figure 36: Activation of Prediction API (docs.google.com, 2016)

It looks like the Prediction API is on, but we need to activate it in Google Developers Console

as well, which has been already explained in Chapter 5, Fig. 37.

Figure 37: Activation of Prediction API in the Google Developers Console (console.developers.google.com, 2016)

Page 67: Project 10.07.16 FINAL EDIT PDF

56

We need to select Prediction API to enable it, Fig. 38.

Figure 38: Enabling of Prediction API in the Google Developers Console (console.developers.google.com, 2016)

Click on enable, Fig. 39.

Figure 39: Confirmation that Prediction API has been enabled in the Google Developers Console (con-sole.develop-

ers.google.com, 2016)

From the above picture, we can clearly see that Prediction API has been enabled successfully.

Page 68: Project 10.07.16 FINAL EDIT PDF

57

Let’s look at the code and what exactly does. The insert method is used to train the model, and

it calls the Prediction API.

var insert_reply = Prediction.Trainedmodels.insert(resource, project_number);

The row above calls the trainedmodels.insert method. So the data that it uses is training_in-

stances and the training instances are placed in:

var training_instances = [];

for (var i = 0; i < instances.length; ++i) {

var output = instances[i][0];

var csv_instance = instances[i].slice(1);

training_instances.push({'output': output, 'csvInstance': csv_instance});

Also gets output values and csv_instance values, so csv_instance are the feature values and for

that it took var output = instances[i][0]; where the values was defined in var instances = selec-

tion.getValues();, which is the selection set in the spreadsheet. The following rows represent

the prediction method:

function predict() {

try {

clearOutput();

var sheet = SpreadsheetApp.getActiveSheet();

var selection = sheet.getActiveSelection();

var instances = selection.getValues();

Page 69: Project 10.07.16 FINAL EDIT PDF

58

var project_number = getProjectNumber();

var model_name = getModelName();

for (var i = 0; i < instances.length; ++i) {

var result = predictSingleRow(project_number, model_name, instances[i]);

selection.getCell(i + 1, 1).setValue(result);

}

} catch(e) {

Browser.msgBox('ERROR:' + e, Browser.Buttons.OK);

}

}

The prediction method is used to fill the missing values, and the magic is happening in the

following rows.

predictSingleRow(project_number, model_name, instances[i]);

selection.getCell(i + 1, 1).setValue(result);

After that, I am using prediction.trainedmodels.predict method which uses the feature values

defined in input_instance.

var prediction_out = Prediction.Trainedmodels.predict(

resource, project_number, model_name);

displayOutput(prediction_out);

Here the instances are again selection of cells selection.getValues();

Page 70: Project 10.07.16 FINAL EDIT PDF

59

To be more specific let’s look at the google spreadsheet dataset. Before using the spreadsheet,

I had to fill the project information which was developed in Google Cloud Console with the ID

number 233110773272. For the model name, we can put any name which in my case is pur-

chase, and the next step is to import the data designed for the purpose of my project.

To insert data, I have to import the excel file which contains the information. The Excel file

contains information about wine products and their prices, Fig. 40.

Figure 40: Excel dataset spreadsheet imported in the Google Spreadsheet (docs.google.com, 2016)

Page 71: Project 10.07.16 FINAL EDIT PDF

60

The process is as follows: By accessing the uploaded documents in my google drive, I need to

select from File Menu-Import and then the file, Fig. 41.

Figure 41: Selection of Excel dataset file called “spreadsheet.CSV” (drive.google.com, 2016)

Click on Replace data starting at selected cell and then Import, Fig. 42.

Page 72: Project 10.07.16 FINAL EDIT PDF

61

Figure 42: Importing: spreadsheet.csv (docs.google.com, 2016)

The following picture clearly represents that our data has been successfully imported, Fig. 43.

Page 73: Project 10.07.16 FINAL EDIT PDF

62

Figure 43: Confirmation Script output: the dataset has been imported successfully (docs.google.com, 2016)

To predict some outputs, I need to delete some of the prices for the wines, Fig. 44.

Figure 44: Final edit of the Google Spreadsheet before using Prediction API models (docs.google.com, 2016)

Page 74: Project 10.07.16 FINAL EDIT PDF

63

The next step is to select the data with the prices to train the model.

Click on Prediction menu which is custom defined and use the prediction functions. Click on

the training model from selection and authorize, Fig. 45, Fig 46.

Figure 45: Authorization request for “Prediction” application (docs.google.com, 2016)

Figure 46: Google Cloud Platform use of OAuth 2.0 for “Prediction” authentication and authorization (cloud.google.com,

2016)

Page 75: Project 10.07.16 FINAL EDIT PDF

64

Click on allow and I have received the following confirmation dialog which represents that the

first stage of the prediction process is completed. Training model from selection is associated

with the INSERT method, Fig. 47:

Figure 47: Request of the INSERT method to begin the training of the dataset (docs.google.com, 2016)

By selecting OK, I have received the output of the API request as follows, Fig. 48:

Figure 48: Confirmation of the INSERT method efficiency (docs.google.com, 2016)

Let’s check the status of the model, from the toolbar select Prediction and then” Get training

status.” The following picture represents information that the connection between the project

and my Google Spreadsheet is running without errors, Fig. 49.

Page 76: Project 10.07.16 FINAL EDIT PDF

65

Figure 49: “Get training status”: Confirmation of connection between Google Cloud Console project and Google Spreadsheet

(docs.google.com, 2016)

The last step is to select the dataset with the missing values that need to be predicted. For the

purpose, I had to select from Prediction menu>>predict instances, Fig. 50.

Figure 50: Results from the execution process of “predict instances” model (docs.google.com, 2016)

Page 77: Project 10.07.16 FINAL EDIT PDF

66

The missing values are filled with new data which needs to be formatted for better understand-

ing. From the Format menu, I can improve the data which has been predicted, Fig. 51.

Figure 51: Formatting of the results (docs.google.com, 2016)

The last step is to publish the file to the web. From the file menu, I had to select File>>publish

to the web and click ok.

Now we are going to www.appsheet.com website to create our app. We have to sign up with

our Google account and use Google drive to (or “intending to”) use our spreadsheet. The pro-

cess is explained below.

Page 78: Project 10.07.16 FINAL EDIT PDF

67

6.2 APPSHEET APPLICATION DEVELOPMENT

The aim is to develop an application that works with Google spreadsheet which has been ex-

amined in Chapter 4 and Chapter 6.

By following the instructions published in www.appsheet.com, I have created a new app and

select the most suitable category for the purpose of the project, Fig. 52, Fig 53.

Figure 52: First stage of the application development (appsheet.com, 2016)

Page 79: Project 10.07.16 FINAL EDIT PDF

68

Figure 53: Name and Category selection process required for the new application (appsheet.com, 2016)

I have chosen Prediction as a name for my App and after selected my own data, Fig. 54.

Page 80: Project 10.07.16 FINAL EDIT PDF

69

Figure 54: Selection of the Google Prediction Spreadsheet required for the application development (appsheet.com, 2016)

I need to select my spreadsheet and it’s going to build an app, Fig. 55.

Figure 55: Setting of the Prediction application (appsheet.com, 2016)

Page 81: Project 10.07.16 FINAL EDIT PDF

70

The AppSheet is a fantastic solution because provides information about the entire process and

engage users into the meaning of each development step, Fig. 56, Fig. 57, Fig. 58, Fig. 59.

Figure 56: Welcome to AppSheet (appsheet.com, 2016)

Figure 57: AppSheet architecture (appsheet.com, 2016)

Page 82: Project 10.07.16 FINAL EDIT PDF

71

Figure 58: Build and deploy an app in three simple steps (appsheet.com, 2016)

Figure 59: Customization options for the application (appsheet.com, 2016)

Once the application is build, I was able to see the entire view, Fig. 60.

Page 83: Project 10.07.16 FINAL EDIT PDF

72

Figure 60: Entire view of the completed "Prediction" application (appsheet.com, 2016)

By selecting the Users menu from the left side of the window, I was allowed to add an entry of

users, Fig. 61.

Figure 61: Adding entries of users (appsheet.com, 2016)

I have added the emails of the participants of this project, and they can do entries.

Page 84: Project 10.07.16 FINAL EDIT PDF

73

When the decision is made about which users are allowed to use the new customized app, they

will receive the following message, Fig. 62:

Figure 62: E-mail invitation for the “Prediction” app installation (gmail.com, 2016)

The steps a quite easy to follow and creating an app with appsheet.com is free. I had to email

the link to my personal email to try the application. Users can run the link in their web browser

which means that it is not essentially to have a mobile phone. The following picture represents

the results gathered from prediction models in completed web application, Fig. 63.

Page 85: Project 10.07.16 FINAL EDIT PDF

74

Figure 63: Google Spreadsheet results gathered from prediction models linked with the Prediction application (appsheet.com,

2016)

By clicking on one of the wine products we can edit the data, Fig. 64. For example: Changing

the features of wine products in the application will update the data associated with the Google

Spreadsheet because they are synchronized and also will allow business owners to train the new

dataset and gather predictions for possible prices of the newly added information.

Page 86: Project 10.07.16 FINAL EDIT PDF

75

Figure 64: Example of a wine product within the application (appsheet.com, 2016)

By selecting the edit button, users can change the data. According to the purpose of the project,

the owners of the small retail businesses can add more wine samples of products. To change

existing information such as wine products, wine rating, the origin of the wine, wine prices and

also to train the new data and generate predictions by using Prediction API models. According

to the example, sometimes we need to update our data, I had to try to add new information to

my spreadsheet and see if the changes are updated within the application to confirm the state-

ment above. So I am going to change some of the data and see if there is any difference in my

application. I have added some new prices according to the wine features, Fig. 65.

Page 87: Project 10.07.16 FINAL EDIT PDF

76

Figure 65: Adding a new data in the spreadsheet required for the evidence (appsheet.com, 2016)

Once we sync the data in our app, the new information appears immediately, Fig. 66, Fig. 67.

Figure 66: “Prediction” application before the execution of Prediction API models (appsheet.com, 2016)

Page 88: Project 10.07.16 FINAL EDIT PDF

77

Figure 67: “Prediction” application after the execution of Prediction API models (appsheet.com, 2016)

The above picture is the evidence that my app runs without errors and also predictions updates

are shown immediately after prediction models are trained again.

Once the application is developed, I had to improve the entire look of the information presented

within the application such as format the columns represented in the Prediction application. The

following picture delivers the current look of my application, but different options could be

implemented to create the better appearance of the app such as adding pictures of the wine

products, adding more users…etc., Fig 68.

Page 89: Project 10.07.16 FINAL EDIT PDF

78

Figure 68: Formatting of the Columns Structure (appsheet.com, 2016)

By running the app in the web browser, I have received the following result: Fig 69.

Figure 69: Final look of the Prediction web application (appsheet.com, 2016)

Page 90: Project 10.07.16 FINAL EDIT PDF

79

The following picture represents the Anatomy of the Prediction mobile app, Fig 70.

Figure 70: Anatomy of the Prediction mobile application (appsheet.com, 2016)

Chapter 7 Reflection and recommendations for future work

7.1 INTRODUCTION

The aim of the following section is to formulate accurate and practical recommendations con-

cerning small retail businesses in the United Kingdom. Also, this could be applied towards

modifying strategies with the aim of expanding business development through mobile and web

Prediction API applications.

Page 91: Project 10.07.16 FINAL EDIT PDF

80

7.2 EVALUATION OF FINDINGS

Mobile and web applications are an expanding trend, which is widely established in most of the

current businesses. The intensive growth of mobile and web applications in developing coun-

tries such as the United Kingdom has opened up the opportunity for small retail businesses to

take advantage of the mobile medium, to communicate with their target audience in a more

efficient and personal manner. The purpose of the project is focused on the extent of which

mobile practices could improve business continuity by using Prediction API models. Also, the

ability of small retail businesses to predict how much a bottle of wine could cost by using pre-

vious purchase history. Secondary data has been obtained from; video tutorials, articles, books,

and documentaries. The documentary uploaded on the Google Cloud Platform delivers a clear

understanding of how to implement Prediction API models and also how they could help small

retail businesses in the United Kingdom to increase profit, reduce business costs and create

competitive advantage.

Example: If the business owners know how much a bottle of wine could cost, they could select

the most appropriate vendor by comparing the prices of the wine products. By choosing the

supplier with the same approximate offer of wine prices, the small retail shops could reduce

business costs which lead to increasing of the profit.

The responses from Prediction API models within the Google spreadsheet developed for the

purpose of this project are clearly represented in my application. The benefits of relating the

outcomes with the application will improve marketing communication between the business

owners and the stakeholders because the characteristics are presented in real time. Nonetheless,

using of Prediction API models is open to limitations, the most common issue small retail busi-

nesses in the United Kingdom tend to experience is according to the understanding of the pre-

diction process. To be more specific the information required for Prediction APIs needs to be

considered carefully. Otherwise, the outcome could be not relevant.

Page 92: Project 10.07.16 FINAL EDIT PDF

81

It should be considered that though the conclusion drawn were enlightening, this project devel-

opment was mostly restricted due to a lack of a large number of contributors from the small

retail business organizations. Mainly, the cause for this limitation is the lack of being able to

gather information from the retail shops according to previous purchase examples of wine prod-

ucts. Furthermore, time constraint was another issue which makes the process of collecting

relevant data not sufficient. However, regardless of restrictions, the results of the developed

application and the entire project have provided valuable awareness into the extent to which

small retail businesses in the United Kingdom could improve business and create competitive

advantage.

7.3 RESEARCH DATA APPLICABILITY TO THE AIMS AND OBJECTIVES OF THE PROJECT

An essential part of verifying the observed data gathered from the investigation is to relate the

aims and objectives stated at the beginning of the project with the concluding results. Three

detailed objectives were mentioned, the achievement of which would deliver the success of the

dissertation. The three objectives are as follows:

1. To investigate current literature associated with the Google Prediction API and the ways of

developing a predictive application.

2. To classify the key benefits of implementing the Prediction API into the small retail busi-

nesses.

3. To formulate some practical background on how the application can be used as a strategic

tool to achieve business objectives.

Page 93: Project 10.07.16 FINAL EDIT PDF

82

The objectives at this moment will be observed in one by one and assessed to establish whether

or not they were accomplished within the project.

Objective One

To investigate current literature associated with the Google Prediction API and the ways of

developing a predictive application. Academics, such as Dorard (2014), Casalboni and Brennan

(2015) conceptualised Prediction API models as being a tool that can perform tasks such as

spam detection, classification of emails or prediction of products that a user might like via mo-

bile or web application. Also, difficulties surrounding the definitional clarity of the Prediction

API were emphasised by cloud.google.com (2016). Though, due to the lack of extensive sec-

ondary research concerning Prediction API implementation in the United Kingdom, the inves-

tigation had to adapt some information to deliver illustrations.

Objective Two

To classify the key benefits of implementing the Prediction API into the small retail businesses.

The main advantages of implementing the Prediction API models into the small retail busi-

nesses in the United Kingdom were linked to the mobile feature such as ubiquity based service

(Richard T. Watson, September 2002), (Clarke, I., 2001). Likewise, the benefits were general-

ised and altered from the secondary data that weren’t specifically related to the United King-

dom. To classify the benefits of Prediction API implementation, it was essential to comprehend

the features that allow small retail businesses to leverage Prediction API models as a part of

their business strategy. Several authors have documented the key features of Google Prediction

API (Dorard, 2014), (Brownlee, 2016) and (Siegel, 11 January 2016).

Page 94: Project 10.07.16 FINAL EDIT PDF

83

7.4 RECOMMENDATIONS

The aim of the third objective mentioned earlier is to formulate some practical background on

how the application could be applied as a strategic tool to achieve business goals.

7.4.1 Designing a Good Model

By adding more examples in the training data, the better predictions could be generated, with

other words more examples improve the results.

Adding more features to the training data could bring more useful patterns. Though, simply

breaking of the columns into more features does not mean that the predictions will be improved.

For example, if I had a table that defines movies, with different columns for each category, for

instance: is_comedy, is_action, is_drama, is_fantasy. It will be better to have a single column

for all genres, where that column is an arbitrary length list of labels such as "comedy," "fantasy,"

"action," …etc. More features mean a unique information such as rating of the movie, the year

of when the movie was made, the director, and so on. Moreover, breaking up all separate col-

umns into a single column allows me to add new categories more directly: adding a new tag to

an instance, rather than adding a new column. The query should have the same number of fea-

tures as my training examples, and also feature values shouldn’t be empty. To be more specific

if there are any empty text features (") this means that they are equal to zero. Both of these can

deliver insufficient results, so in the spreadsheet always needs to be inserted some data for the

each of the features.

While preparing the dataset which will be used for predictions, individuals must include all the

features that can have a substantial effect on the results. A good rule of thumb is to let the

Prediction API to choose which features are significant. According to the weather, daytime or

Page 95: Project 10.07.16 FINAL EDIT PDF

84

purchases, individuals cannot always consider what could have a predictive influence. Some of

the features might have a negative impact, but is useful to know this while we are developing

our training dataset.

The regression training model should be used in case of consistently assigned accurate values

to each instance; it is better to assign ratings to each feature for larger accuracy. According to

the training data used for the purpose of this project I have to assign a wine rating index from

1–5 for each of the wine products.

7.5 CONCLUSION

The important aspects of this dissertation are grounded on an examination of different ap-

proaches for implementation of Google Prediction API in the small retail businesses in the

United Kingdom. Readers can find information on how to use prediction models, how to de-

velop an AppSheet application and how they could be applied for business purposes. Critically

observed there are substantial gaps in the current information on Prediction API models devel-

opment. To deliver satisfactory outcomes, I could get more knowledgeable in designing of pre-

diction models. The understanding of machine learning is one of the critical aspects for distrib-

uting the finest conclusion of this project. Also gathering of evidence for the purpose of using

relevant dataset and Prediction API implementation involves the collection of information from

a different retail business which requires time and most of the time is difficult due to the security

and ethical issues. Another critical factor refers to my programming capabilities. Prediction

application development process requires Python as a programming language which is signifi-

cant for the efficient development of scripts.

Page 96: Project 10.07.16 FINAL EDIT PDF

85

7.6 DIRECTIONS FOR FURTHER STUDY

This research was firmly related to Prediction models usage and application development prac-

tices. Several other application development platforms were not involved in the scope of this

project, such as Android and Google Cloud development console. However, one development

application solution that did seep into the project was the AppSheet applications development

due to the lack of experience. Though, due to time considerations, those not presented could

not be further discovered within this project. Also, the further methodological methods could

not be discovered, in the form of user investigations and also a broader depth of semi-structured

meetings due to resources and time limitation.

7.7 SUMMARY

This chapter conveys the project to a conclusion into the extent to which the small retail busi-

nesses in the United Kingdom could improve business continuity by implementing Prediction

API models within an application. The final chapter goals are to summarise the discoveries of

the research and to examine the research objectives. Finally, the chapter ends with a few rec-

ommendations, directions for further study on the topic and a conclusion.

Page 97: Project 10.07.16 FINAL EDIT PDF

86

References:

Academy, C., 2016. Courses. [Online]

Available at: https://cloudacademy.com/courses/?provider=google [Accessed 13 July 2016].

Addison, D., 19 April 2016. Implementation of Google Prediction API with Example.

[Online] Available at https://www.youtube.com/watch?v=JrkhF7YJesw [Accessed 10 July

2016].

Agrawal, R., 18 March 2013. What are some of the cool applications/use cases of Google Pre-

diction API? [Online] Available at: https://www.quora.com/What-are-some-of-the-cool-appli-

cations-use-cases-of-Google-Prediction-API [Accessed 26 June 2016].

Alan Bryman, E. B., June 2011. Business Research Methods. 3 ed. USA: Oxford University

Press.

Almeida, I., 12 May 2015. Machine Learning as a Service. [Online] Available at:

https://blog.onliquid.com/machine-learning-service-benchmark/ [Accessed 28 August 2016].

Anon., 15 July 2016. Overview of Cloud Endpoints. [Online] Available at:

https://cloud.google.com/appengine/docs/java/endpoints/ [Accessed 15 August 2016].

Anon., 2016. Quickstart. [Online] Available at: https://cloud.google.com/predic-

tion/docs/quickstart [Accessed 21 August 2016].

appsheet.com, 2016. Prediction-AppSheet. [Online] Available at:

https://www.appsheet.com/Template/AppDef?appName=Prediction-187821# tab_appData

[Accessed 03 September 2016].

Barry, P., 30 November 2010. Head First Python. 1 ed. USA: O'Reily Media Inc. 494.

Blog, 2016. "App Engine Backend with Google Cloud Messaging" Template. [Online]

Available at: https://github.com/GoogleCloudPlatform/gradle-appengine templates/tree/mas-

ter/GcmEndpoints [Accessed 30 July 2016].

Blog, G. C. P., 26 June 2016. Tutorial: Adding a cloud backend to your application with An-

droid Studio. [Online] Available at: https://cloudplatform.googleblog.com/2013/06/tutorial-

adding-cloud-backend-to-your-application-with-android-studio_26.html [Accessed 27 July

2016].

Brennan, M. W., 08 May 2015. How to Use Google’s Prediction API to Dig into Adwords.

[Online] Available at: http://www.programmableweb.com/news/how-to-use-google’s-predic-

tion-api-to-dig-adwords/how-to/2015/05/08 [Accessed 22 August 2016].

Brennan, M. W., 27 May 2015. How to Build Machine Learning with Google Prediction API.

[Online] Available at: http://www.programmableweb.com/news/how-to-build-machine-learn-

ing-google-prediction-api/how-to/2015/05/27 [Accessed 05 July 2016].

Brownlee, J., 2016. Machine Learning Mastery Resource Guide. Machine Learning Mastery,

Volume 1.3, p. 12.

Page 98: Project 10.07.16 FINAL EDIT PDF

87

Builder, R. A., 11 March 2014. How to Build an Android app with a Google Docs Spread-

sheet Feed. [Online] Available at: https://www.youtube.com/watch?v=pIAOp2V0myM [Ac-

cessed 11 08 2016].

Carter, E., 18 February 2016. Google Opens Cloud Vision API Beta to Entire Developer

Community. [Online] Available at: http://www.programmableweb.com/news/google-opens-

cloud-vision-api-beta-to-entire-developer-community/brief/2016/02/18 [Accessed 28 June

2016].

Casalboni, A., 12 May 2015. Google Prediction API: A Machine Learning black box for de-

velopers. [Online] Available at: http://cloudacademy.com/blog/google-prediction-api/

[Accessed 22 August 2016].

Cloud Platform Console Help, 2016. Locate the project ID and project number. [Online]

Available at: https://support.google.com/cloud/answer/6158840?hl=en [Accessed 01 July

2016].

Console, D., 2016. Introduction to Android. [Online] Available at: developer.an-

droid.com/guide/index.html [Accessed 04 August 2016].

David Berlind, W. S., 2016. What Are APIs and How Do They Work? [Online]

Available at: http://www.programmableweb.com/api-university/what-are-apis-and-how-do-

they-work [Accessed 14 July 2016].

Developers, G., 06 June 2008. Google I/O 2008 - Working with Google App Engine Models.

[Online] Available at: https://www.youtube.com/watch?v=rRCx9e38yr8 [Accessed 25 June

2016].

Developers, G., 21 January 2015. Introducing Google Cloud Platform Resources. [Online]

Available at: https://www.youtube.com/watch?v=eMlwcZSt7vk [Accessed 22 June 2016].

Doraisamy, M., 30 October 2014. How I: Use Google Prediction API to improve customer

service. [Online] Available at: https://www.youtube.com/watch?v=GZmK-3sZ9hc [Accessed

25 July 2016].

Dorard, L., 11 August 2014. Create Space Independent Publishing Platform. In: Bootstrap-

ping Machine Learning: The first guide to Prediction APIs. USA: USA, p. 206.

Dorard, L., 2013. WHEN MACHINE LEARNING FAILS. [Online] Available at:

file:///C:/Users/User/Desktop/PROGECT/Technical%20screenshots/When%20Ma-

chine%20Learning%20fails.pdf [Accessed 22 August 2016].

Dorard, L., 2014. Beat the competition. [Online]

Available at: https://www.youtube.com/watch?v=idDw4fyazXc&feature=youtu.be [Accessed

23 July 2016].

Dorard, L., 2014. BigML overview. [Online] Available at:

https://www.youtube.com/watch?v=IapOVS7a2kM [Accessed 24 August 2016].

Page 99: Project 10.07.16 FINAL EDIT PDF

88

Dorard, L., 2014. Bootstrapping Machine Learning. [Online] Available at: file:///C:/Us-

ers/User/AppData/Local/Temp/Temp1_Complete-package-beta-2%20(1).zip/Complete-pack-

age-beta-2/Bootstrapping-Machine-Learning-1.0.5.pdf [Accessed 14 June 2016].

Dorard, L., 2014. Google Prediction API setup. [Online] Available at:

https://www.youtube.com/watch?v=y1IUyVfDiGM [Accessed 23 July 2016].

Dorard, L., 2014. HOW TO IMPROVE YOUR BUSINESS BY PREDICTING CHURN.

[Online] Available at: file:///C:/Users/User/Desktop/PROGECT/Latest%20Materi-

als%2026.06.16%20Prediction/How%20to%20improve%20your%20business%20by%20pre-

dicting%20churn%20NO.pdf [Accessed 23 July 2016].

Dorard, L., 2014. Prediction Spreadsheet with Google Apps Script. [Online]

Available at: https://www.youtube.com/watch?v=-RCKSt-VrRM [Accessed 23 July 2016].

Dorard, L., 30 June 2014. Google Prediction API setup. [Online] Available at:

https://www.youtube.com/watch?v=y1IUyVfDiGM [Accessed 28 July 2016].

docs.google.com, 2016. Google Spreadsheet for Predictions. [Online]

Available at: https://docs.google.com/spread-

sheets/d/1IQ2J_6glaBZg5H0dPwDg5ODVZ00pyv_9hKVj_UPJyxk/edit#gid=7 [Accessed 03

September 2016].

drive.google.com, 2016. My Drive. [Online] Available at:

https://drive.google.com/drive/u/0/my-drive [Accessed 03 September 2016].

Gaur, M., 20 April 16. What will be great uses cases for the Google Prediction API? [Online]

Available at: https://www.quora.com/What-will-be-great-uses-cases-for-the-Google-Predic-

tion-API [Accessed 02 August 2016].

G, D., 2010. What is machine learning? [Online] Available at: http://stackoverflow.com/ques-

tions/2620343/what-is-machine-learning [Accessed 25 August 2016].

Google Cloud Platform, 19 August 2016. Quickstart. [Online] Available at:

https://cloud.google.com/prediction/docs/quickstart#send_a_query [Accessed 22 August

2016].

Google Cloud Platform, 19 August 2016. Samples and Libraries. [Online] Available at:

https://cloud.google.com/prediction/docs/libraries#getting-started-with-the-google-api-client-

library-for-ruby [Accessed 02 July 2016].

Google Cloud Platform, 2016. Google Cloud Prediction API Documentation. [Online] Avail-

able at: https://cloud.google.com/prediction/docs/ [Accessed 25 August 2016].

Green, T., 10 May 2011. Build smarter apps with the improved Google Prediction API.

[Online] Available at: http://googleforwork.blogspot.co.uk/2011/05/build-smarter-apps-with-

improved-google.html [Accessed 05 July 2016].

H. Onur Bodur, K. M. D. B. G., 2014. Will You Purchase Environmentally Friendly Prod-

ucts? Using Prediction Requests to Increase Choice of Sustainable Products. [Online]

Page 100: Project 10.07.16 FINAL EDIT PDF

89

Available at: http://0-link.springer.com.lispac.lsbu.ac.uk/article/10.1007/s10551-014-2143-6

[Accessed 27 August 2016].

H. Onur Bodur, K. M. D. B. G., 22 March 2014. Interpretable Classifiers for fMRI Improve

Prediction of Purchase, Volume 1, pp. 59-57, 129.

Irani, R., 29 March 2016. How to Build a Monitoring Application with the Google Cloud Vi-

sion API. [Online] Available at: http://www.programmableweb.com/news/how-to-build-mon-

itoring-application-google-cloud-vision-api/how-to/2016/03/29 [Accessed 17 July 2016].

Ivanova, I., 2016. Prediction app. [Online] Available at:

https://www.appsheet.com/start/e97a2040-92a0-4a56-9be2 bb2d1a25da52#_appName=Pre-

diction-187821&_columnOrder=%5B%5D&_columnWidth=%22Default%22&_con-

trol=Worksheet&_groupBy=%5B%5D&_page=fastTable&_sortBy=%5B%7B%22Col-

umn%22%3A%2223%22%2C%22Order%22%3A%22Ascen [Accessed 21 August 2016].

Ivanova, I., 2016. Wine Project. [Online] Available at: https://con-

sole.cloud.google.com/home/dashboard?project=wine-1357 [Accessed 21 August 2016].

Jordan, J., 2016. Advantages and disadvantages of inductive reasoning. [Online]

Available at: http://www.ehow.co.uk/info_8491871_advantages-disadvantages-inductive-rea-

soning.html [Accessed 03 September 2016].

Kumar, D. S. P., 05 August 2013. Prediction of Consumer Purchase Decision using Demo-

graphic Variables: A Study with Reference to Premium Car. Volume 12, pp. 117-120.

Langit, L., 23 September 2015. Google Cloud Platform Essential Training. [Online]

Available at: https://www.lynda.com/Cloud-tutorials/Using-Prediction-API/383928/436538-

4.html [Accessed 16 June 2016].

Lipton, Z. C., 2015. Cloud Machine Learning Wars: Amazon vs IBM Watson vs Microsoft

AzureCloud Machine Learning Wars: Amazon vs IBM Watson vs Microsoft Azure. [Online]

Available at: http://www.kdnuggets.com/2015/04/cloud-machine-learning-amazon-ibm-wat-

son-microsoft-azure.html [Accessed 21 August 2016].

Lowery, J., 25 March 2014. Up and Running with Cloud Service APIs. [Online]

Available at: https://www.lynda.com/API-tutorials/Connecting-Android/151707/167545-

4.html [Accessed 22 June 2016].

Margaret Rouse, 2016. machine learning. [Online] Available at: http://whatis.tech-

target.com/definition/machine-learning [Accessed 25 August 2016].

MathWorks, 2016. Machine Learning Challenges: Choosing the Best Model and Avoiding

Overfitting. [Online] Available at: file:///C:/Users/User/Desktop/PROGECT/Latest%20Mate-

rials%2026.06.16%20Prediction/87371_92974v00_Machine_Learning_Whitepaper.pdf [Ac-

cessed 22 August 2016].

Mombrea, M., 29 September 2011. Getting Started with the Google Prediction API. [Online]

Available at: http://cypressnorth.com/technology/getting-started-with-the-google-prediction-

api/ [Accessed 20 June 2016].

Page 101: Project 10.07.16 FINAL EDIT PDF

90

Mulholland, E. & P. Mc Kevitt, T. L. J. F., 10 June 2015. 360-MAM-Affect: Sentiment analy-

sis with the Google prediction API and EmoSenticNet, pp. 217-221.

Ohri, A., 30 July 2012. Predict the future with Google Prediction API. [Online]

Available at: http://www.programmableweb.com/news/predict-future-google-prediction-

api/2012/07/30 [Accessed 22 August 2016].

Pathak, D., 15 December 2015. HES Cloud Computing (Google Prediction API) - Long.

[Online] Available at: https://www.youtube.com/watch?v=IS4dWs9va0M [Accessed 09 July

2016].

Platform, G. C., 15 July 2016. HelloEndpoints with Android Studio. [Online] Available at:

https://cloud.google.com/appengine/docs/java/endpoints/helloendpoints-android-studio [Ac-

cessed 21 08 2016].

Platform, G. C., 19 August 2016. Purchase Prediction. [Online] Available at:

https://cloud.google.com/prediction/docs/scenarios#purchaseprediction [Accessed 15 June

2016].

Platform, G. C., 2016. Machine Learning and Pattern Matching. [Online] Available at:

https://cloud.google.com/prediction/ [Accessed 23 07 2016].

Platform, G. C., 2016. Powerful & Simple Storage. [Online] Available at:

https://cloud.google.com/storage/ [Accessed 19 June 2016].

Platform, G. C., 28 March 2016. DATA & ANALYTICS - Build smart applications with your

new superpower: cloud machine learning. [Online] Available at:

https://www.youtube.com/watch?v=Ja2hxBAwG_0 [Accessed 26 June 2016].

Play, G., 2016. AppSheet. [Online] Available at: https://play.google.com/store/apps/de-

tails?id=x1Trackmaster.x1Trackmaster&hl=en [Accessed 28 August 2016].

QVSource, 25 September 2013. Creating A Training Data Set and Google Predict Model Us-

ing QlikView and QVSource. [Online] Available at: http://wiki.qvsource.com/Creating-A-

Training-Data-Set-And-Google-Predict-Model-Using-QlikView-And-QVSource.ashx [Ac-

cessed 02 July 2016].

Rajani Sharma, R. K. T., 2014. Literature review: Cloud Computing –Security Issues, Solu-

tion and Technologies. [Online] Available at: http://www.ijer.in/ijer/publica-

tion/v3s4/IJER_2014_408.pdf [Accessed 16 July 2016].

Richard T. Watson, L. F. P. P. B. G. M. Z., September 2002. U-commerce: Expanding the

universe of marketing. Journal of the Academy of Marketing Science, 30(4), pp. 333-347.

Robust, M., 14 April 2015. How do Amazon's machine learning service, Microsoft Azure ML

and Google's prediction API compare? [Online] Available at: https://www.quora.com/How-

do-Amazons-machine-learning-service-Microsoft-Azure-ML-and-Googles-prediction-API-

compare [Accessed 16 July 2016].

Page 102: Project 10.07.16 FINAL EDIT PDF

91

Rouse, M., 2016. Google Spreadsheets. [Online] Available at: http://searchsoa.tech-

target.com/definition/Google-Spreadsheets [Accessed 21 August 2016].

Royal Literary Fund, 2016. What is a literature review? [Online] Available at:

https://www.rlf.org.uk/resources/what-is-a-literature-review/ [Accessed 25 August 2016].

Salesforce, 2016. http://image.slidesharecdn.com/lk9yup8ctti4s8scvpkg-signature-

7873c75031ac31677418d06ca1135ba58cf1db5a062456d83a04778887726afe-poli-

151012220137-lva1-app6891/95/practical-machine-learning-with-prediction-apis-11-

638.jpg?cb=1444699198. [Online] Available at: http://im-

age.slidesharecdn.com/lk9yup8ctti4s8scvpkg-signature-

7873c75031ac31677418d06ca1135ba58cf1db5a062456d83a04778887726afe-poli-

151012220137-lva1-app6891/95/practical-machine-learning-with-prediction-apis-11-

638.jpg?cb=1444699198 [Accessed 02 September 2016].

Siegel, E., 11 January 2016. Predictive Analytics: The Power to Predict Who Will Click, Buy,

Lie, or Die. [Online] Available at: https://www.amazon.com/Predictive-Analytics-Power-Pre-

dict-Click/dp/1119145678?ie=UTF8&keywords=Predictive%20Analyt-

ics%3A%20The%20Power%20to%20Pre-

dict%20Who%20Will%20Click%2C%20Buy%2C%20Lie%2C%20or%20Die&linkCode=sl1

&linkId=e4c6911a2b3d9fcb1b1c0df72be5ebda [Accessed 17 June 2016].

Sphon, C., 25 January 2016. Creating an app (Database) that works with Google Sheets!

[Online] Available at: https://www.youtube.com/watch?v=or78bBOeFU0&spfreload=10 [Ac-

cessed 10 August 2016].

Studio, A., 2016. Meet Android Studio. [Online] Available at: https://developer.an-

droid.com/studio/intro/index.html [Accessed 10 July 2016].

Support, B., 2016. What is a CSV file and how do I save my spreadsheet as one? [Online]

Available at: support.bigcommerce.com/articles/Public/What-is-a-CSV-file-and-How-Do-I-

save-my-spreadsheet-as-one [Accessed 18 June 2016].

script.google.com, 2016. Prediction Wine-Basic Script. [Online]

Available at: https://script.google.com/macros/d/MTrJhvGL1218XAFtRsCWqB-

SUCrVfXa6eb/edit?uiv=2&mid=ACjPJvEtCkThGgEZBWl1ms30c4sDE9miUjjfolVp-

PlAMrHLGHLh2jh53udYOVSoMl81wFTDuqUt9Pu4JHunDpF8OVv-D7r_syx0AM_RqOk-

mCQpkLj7q7ZPMp7WIwGa_AI-yOa6Wq1NEo [Accessed 03 September 2016].

script.google.com, 2016. Prediction. [Online]

Available at: https://script.google.com/macros/d/MXv0i6U8JlI_G9uOU4D6h9CU-

CrVfXa6eb/edit?uiv=2&mid=ACjPJvGvwdRu7Or9kAnrZVcIZtjrz8BFPvb7MFHjiu-

dtdZtKyPXheiRxBCg02l3fqoyoLavjjmm94KNS8dHGizZEYHv2GOsRHPyUk5XCk-

KRCXlSJRBoDpZewtzhPLnx0DFniF7jGTkzQ [Accessed 03 September 2016].

Tian Tian, S. A. C. J. G., 29 July 2011. A prediction model for web search hit counts using

word frequencies. Journal of Information Science, Volume 3, pp. 462-475.

Video, D., 05 October 2015. Practical Machine Learning with Prediction APIs. [Online]

Available at: https://www.youtube.com/watch?v=69-yq1On3Jk [Accessed 08 July 2016].

Page 103: Project 10.07.16 FINAL EDIT PDF

92

wines, F. S. g. t. F., 2012. Types of white wines. [Online] Available at:

http://www.frenchscout.com/types-of-white-wines [Accessed 15 June 2016].

Yuanzhuo Wang, J. L. Q. L. Y. R., 09 September 2015. Prediction of purchase behaviours

across heterogeneous social networks, pp. 71, 3320-3336.

Yin, R. K. (2009). Case study research: Design and methods (4th Ed.). Thousand Oaks, CA:

Sage.

Zazueta, R., 09 October 2013. What is a RESTful API? [Online] Available at:

http://www.mashery.com/blog/what-restful-api [Accessed 21 August 2016].

Page 104: Project 10.07.16 FINAL EDIT PDF

93

Appendix A:

Page 105: Project 10.07.16 FINAL EDIT PDF

94

Appendix B: My Basic Script

function main() {

var doc = DocumentApp.create("my test document");

for (var i = 0; i < 10; i++) {

//only consider the first message (index zero)

doc.appendParagraph("heading " + i).setHeading(DocumentApp.ParagraphHead-

ing.HEADING2);

doc.appendParagraph("paragraph " + i);

}

Logger.log("Done");

}

Page 106: Project 10.07.16 FINAL EDIT PDF

95

Appendix C: The Script associated with Google Spreadsheet

FILE 1: PREDICTION API CODE

/* This code is specific to the Prediction API (and may change when the API changes) */

function insert() {

try {

var sheet = SpreadsheetApp.getActiveSheet();

var selection = sheet.getActiveSelection();

var instances = selection.getValues();

var project_number = getProjectNumber();

var model_name = getModelName();

clearOutput();

var training_instances = [];

for (var i = 0; i < instances.length; ++i) {

var output = instances[i][0];

var csv_instance = instances[i].slice(1);

training_instances.push({'output': output, 'csvInstance': csv_instance});

}

var user_reply = Browser.msgBox('Start Training:', JSON.stringify(training_instances),

Browser.Buttons.OK_CANCEL);

if (user_reply == 'ok') {

var resource = {'id': model_name, 'trainingInstances': training_instances};

var insert_reply = Prediction.Trainedmodels.insert(resource, project_number);

displayOutput(insert_reply);

}

} catch(e) {

Browser.msgBox('ERROR:' + e, Browser.Buttons.OK);

}

}

function get() {

try {

clearOutput();

var project_number = getProjectNumber();

var model_name = getModelName();

var training_status = Prediction.Trainedmodels.get(project_number, model_name);

displayOutput(training_status);

} catch(e) {

Browser.msgBox('ERROR:' + e, Browser.Buttons.OK);

}

}

Page 107: Project 10.07.16 FINAL EDIT PDF

96

function predict() {

try {

clearOutput();

var sheet = SpreadsheetApp.getActiveSheet();

var selection = sheet.getActiveSelection();

var instances = selection.getValues();

var project_number = getProjectNumber();

var model_name = getModelName();

for (var i = 0; i < instances.length; ++i) {

var result = predictSingleRow(project_number, model_name, instances[i]);

selection.getCell(i + 1, 1).setValue(result);

}

} catch(e) {

Browser.msgBox('ERROR:' + e, Browser.Buttons.OK);

}

}

function predictSingleRow(project_number, model_name, row) {

var input_instance = row.slice(1);

var resource = {'input' : {'csvInstance': input_instance}};

var prediction_out = Prediction.Trainedmodels.predict(

resource, project_number, model_name);

displayOutput(prediction_out);

if (prediction_out.getOutputLabel() != null) {

return prediction_out.getOutputLabel();

} else {

return prediction_out.getOutputValue();

}

}

function update() {

try {

clearOutput();

var sheet = SpreadsheetApp.getActiveSheet();

var selection = sheet.getActiveSelection();

var instances = selection.getValues();

var user_reply = Browser.msgBox('Update Model?', Browser.Buttons.OK_CANCEL);

if (user_reply == 'ok') {

var project_number = getProjectNumber();

var model_name = getModelName();

for (var i = 0; i < instances.length; ++i) {

updateSingleRow(project_number, model_name, instances[i]);

}

}

Page 108: Project 10.07.16 FINAL EDIT PDF

97

} catch(e) {

Browser.msgBox('ERROR:' + e, Browser.Buttons.OK);

}

}

function updateSingleRow(project_number, model_name, row) {

var output = row[0];

var csv_instance = row.slice(1);

var resource = {'output' : output, 'csvInstance' : csv_instance};

var result = Prediction.Trainedmodels.update(

resource, project_number, model_name);

displayOutput(result);

}

function analyze() {

try {

clearOutput();

var project_number = getProjectNumber();

var model_name = getModelName();

var result = Prediction.Trainedmodels.analyze(project_number, model_name);

displayOutput(result);

} catch(e) {

Browser.msgBox('ERROR:' + e, Browser.Buttons.OK);

}

}

function list() {

try {

clearOutput();

var project_number = getProjectNumber();

var result = Prediction.Trainedmodels.list(project_number);

displayOutput(result);

} catch(e) {

Browser.msgBox('ERROR:' + e, Browser.Buttons.OK);

}

}

FILE 2: HELP FUNCTIONS

/* Methods that show help and populate menus */

function onOpen() {

var sheet = SpreadsheetApp.getActiveSpreadsheet();

var menuEntries = [{name: 'Train new model from selection (Insert)', functionName: 'insert'},

{name: 'Get training status (Get)', functionName: 'get'},

Page 109: Project 10.07.16 FINAL EDIT PDF

98

{name: 'Predict Instances (Predict)', functionName: 'predict'},

{name: 'Update existing model (Update)', functionName: 'update'},

{name: 'Analyze training data (Analyze)', functionName: 'analyze'},

{name: 'List existing models (List)', functionName: 'list'} ];

sheet.addMenu('Prediction', menuEntries);

var helpMenuEntries = [{name: 'README', functionName: 'showInstructions'},

{name: 'Insert', functionName: 'insertHelp'},

{name: 'Get', functionName: 'getHelp'},

{name: 'Predict', functionName: 'predictHelp'},

{name: 'Update', functionName: 'updateHelp'},

{name: 'Analyze', functionName: 'analyzeHelp'},

{name: 'List', functionName: 'listHelp'} ];

sheet.addMenu('Prediction Help', helpMenuEntries);

}

function showInstructions() {

instructions = '<font face="Courier New">' +

'<p>This spreadsheet is read-only and it belongs to my Google Drive account

([email protected]), which means that you won\'t be able to use the scripts that are as-

sociated to it. To do so, you should make your own copy by going to File -> Make a Copy...

and choose "Prediction Spreadsheet" as a name. In the new spreadsheet, you should delete this

"README" sheet so you don\'t confuse the two spreadsheets.</p>' +

'<p>Follow the instructions outlined in the screencast.</p>' + '</font>';

instructions_html = HtmlService.createHtmlOutput(instructions);

instructions_html.setHeight(300);

instructions_html.setWidth(800);

SpreadsheetApp.getActiveSpreadsheet().show(instructions_html);

}

function insertHelp() {

Browser.msgBox("To Insert a new model, select the data to train on the (with first row " +

"being the output label) and click the 'Insert' button.");

}

function getHelp() {

Browser.msgBox("To Get the status of an existing model, click the 'Get' button.");

}

function predictHelp() {

Browser.msgBox("To Predict using an existing model, select the instances on which to " +

"predict with the left-most column empty (as a result of the call, this " +

"column will be populated with the predicted labels) and click the " +

"'Predict' button.");

}

function updateHelp() {

Browser.msgBox("To Update an existing model, select the instances with which to update "

+

Page 110: Project 10.07.16 FINAL EDIT PDF

99

"(with first row being the output label) and click the 'Update' button.");

}

function analyzeHelp() {

Browser.msgBox("To call Analyze on an existing model, click the 'Analyze' button.");

}

function listHelp() {

Browser.msgBox("To List all the models under a given project, click the 'List' button.");

}

FILE 3: METHODS FOR ACCESSING VALUES STORED IN THE SPREADSHEET

/* Methods for accessing values stored in the spreadsheet */

function getProjectNumber() {

var sheet = SpreadsheetApp.getActiveSheet();

var project_number = sheet.getRange(1, 2).getValue();

if (project_number == "") {

// Project number is not set, so we prompt user.

project_number = Browser.inputBox("Enter project number:");

sheet.getRange(1, 2).setValue(project_number);

}

return project_number;

}

function getModelName() {

var sheet = SpreadsheetApp.getActiveSheet();

var model_name = sheet.getRange(2, 2).getValue();

if (model_name == "") {

// Model name is not set, so we prompt user.

model_name = Browser.inputBox("Enter model name:");

sheet.getRange(2, 2).setValue(model_name);

}

return model_name;

}

function clearOutput() {

var sheet = SpreadsheetApp.getActiveSheet();

sheet.getRange(1, 4).setValue('');

}

function displayOutput(output) {

var sheet = SpreadsheetApp.getActiveSheet();

sheet.getRange(1, 4).setValue(sheet.getRange(1, 4).getValue() + JSON.stringify(output) +

'\n');

}