Part 2- https://medium.com/aixdesign/getting-started-with-ml5-js-tutorial-part-ii-posenet-ca142c2e05d1
.
In this article, we will learn how to deploy a machine learning model using NodeJS. While doing so we will make a simple handwritten digit recognizer using NodeJS and tensorflow.js.
.
Tensorflow.js is an ML library for JavaScript. It helps to deploy machine learning models directly into node.js or a web browser.
.
Training the Model: For training the model we are going to use Google Colab. It is a platform where we can run all our python code, and it comes loaded with most of the machine learning libraries that are used.
.
https://www.geeksforgeeks.org/how-to-deploy-a-machine-learning-model-using-node-js/
.
html
javascript
See the Pen Untitled by smartcomputing123 (@smartcomputing123) on CodePen.
.
1) View -> Open View
2) select (or type) Outline
3) You'll now get an Outline palette that shows full information on the class including properties and functions.
.
GitHub allows online users to share files but they cannot be directly loaded and executed. The solution to this ie for loading files such as JS and CSS is to load through RawGit. RawGit serves raw files directly from GitHub with proper Content-Type headers.
Steps:
First:- Sign up With GitHub
Second:- Creating a Repository on GitHub
Third:- Creating a GitHub Project to host JS and CSS files
Fourth:- Adding GitHub file or gist URL on RawGit for serving file on our Website.
REFERENCE:
https://www.bloggerspice.com/2016/09/host-JavaScript-and-CSS-files-on-gitHub-through-rawgit.html
This project is extended from the original tutorial at :
https://erthru.medium.com/membuat-restful-api-menggunakan-framework-codeigniter-3-f350755b1274
and
https://erthru.medium.com/membuat-restful-api-menggunakan-framework-codeigniter-3-part-2-163cadb32e3a
The author has provided a completed project codes at:
https://github.com/erthru/restCI
or
https://drive.google.com/file/d/1tYrLlnPb4Gc-9769LyoLOcYcVKf2tYl4/view?usp=sharing
Download the code from the source at Step 1 above.
Upload the zip file to your server, extract the content and rename the folder as "restci".
Go into restci/application/config/ and edit the file database.php as follows:
note: it is recommended to use DB Browser application to create the database. The application can be downloaded from https://sqlitebrowser.org/dl/
You should get a json output that shows no record in the database.
Use a REST Client like POSTMAN to send POST Request according to the following settings:
go to the url {{your serverpath}}/restci/index.php/person
Now you get the following json output:
{"status":200,"error":false,"person":[{"id":1,"name":"suprianto","address":"jln testing","phone":123}]}
If you want to hide the index.php string in the url, you can put .htaccess file in the restci folder. Put the following codes into the file. This requires Apache mod_rewrite enabled.
.
Machine Learning is often considered equivalent with Artifical Intelligence.
This is not correct. Machine learning is a subset of Artificial Intelligence.
Machine Learning is a disipline of AI that uses data to perform supervised or unsupervised machine training.
ML systems combines Input to produce Predictions.
Key terminologies are:
In Machine Learning terminology, the label is the thing we want to predict.
It is like the y in a linear graph:
y = ax + b
In Machine Learning terminology, the features are the input.
They are like the x values in a linear graph:
y = ax + b
A Model defines the relationship between the label (y) and the features (x).
There are three phases in the life of a model:
Machine Learning can teach a computer to solve many questions like:
Before Machine Learning can start, you need to collect some data.
If you want to predict house prices, you need to collect some information about house prices.
The goal of training is to create a model that can answer our question. Like what is the expected price for a house?
Inference is when the trained model is used to infer (predict) values using live data. Like putting the model into production.
This Model predicts prices using a linear regression function:
# Name the Axis
plt.title('House Prices vs Size')
plt.xlabel('Square Meters')
plt.ylabel('Price in Millions')
# Set x and y values
x = np.array([50,60,70,80,90,100,110,120,130,140,150,160])
y = np.array([7,8,8,9,9,9,9,10,11,14,14,15])
# Call Linear Regression Function
slope, intercept, r, p, std_err = stats.linregress(x, y)
# Plot Data
plt.scatter(x, y)
plt.plot(x, slope * x + intercept)
plt.show()
Try it Yourself »In the example above, the slope and intercept is calculated by a function called linregress.
A linear relationship is written as y = ax + b
Where:
With ML, a linear relationship is written as y = b + wx
Where:
Sometimes there can be many features (input values) with different weights:
y = b + w1x1 + w2x2 + w3x3 + w4x4
.
https://web.archive.org/web/20210220012931/https://www.w3schools.com/ai/ai_machine_learning.asp
.
.
These days, several JavaScript AI framework are emerging.
JavaScript frameworks make it possible to execute AI tasks in the browser.
Artificial Intelligence has changed the science of image processing, computer vision, and natural language applications.
Thanks to new AI libraries, JavaScript developers can now build machine learning and deep learning applications without Python or R. This way JavaScript can help developers to bring AI to the browser and to the web.
Most AI applications these days use R or Python.
But JavaScript has a great future as an AI language, and it even has a some advantages:
WebGL is a JavaScript API for rendering 2d and 3D graphics in any browser.
WebGL can run on both integrated and stanalone graphic cards in any PC.
WebGL brings 3D graphics to the web browser. Major browser vendors Apple (Safari), Google (Chrome), Microsoft (Edge), and Mozilla (Firefox) are members of the WebGL Working Group.
WebGL 1.0 was released in March 2011.
WebGL 2.0 was released in January 2017.
TensorFlow Playground is a web application written in d3.js.
With TensorFlow Playground you can learn about Neural Networks (NN) without math.
In your own Web Browser you can create a Neural Network and see the result.
Plotting provided by: Plotly
.
https://web.archive.org/web/20210220012909/https://www.w3schools.com/ai/ai_javascript.asp
.