how to put an accuracy graph on the ml5.js? - javascript

I am using the ml5.js to learn machine learning, so I want to now how to put an accuracy graph on the ml5.js? I am building a neural network.
I used ml5.neuralNetwork with the debug options as true, but I only have the loss graph.

Related

API for Trend Forecasting Javascript

I have a list of values over time (basically a list of integers).
Currently the NPM website is down so I can't really search for API's properly, therefore I am asking if any of you know an API for Javascript Node which takes an input of a list of integers (representing y coordinates on a graph) and can then make a prediction of how the graph will continue to flow.
Thank you very much for any responses!
It depends on how you want to make a prediction. You can calculate a linear regression, fit a time series model, train a neural network, etc.
The easiest is a linear regression model. It won't be very accurate; just give you a sense of direction as to where the data is going at the current time.
Time series modelling (autoregression) is probably what you are looking for. This usually involves using historical data to fit a model that can be used to predict (referred to as forecast) future values. This involves some fairly heavy lifting with statistics, but JavaScript libraries do exist, like timeseries-analysis.
If you want to create a fully-blown neural network, tensorflow is being developed for JavaScript, but I wouldn't recommend this approach unless you have a fairly good understanding of machine learning. In order to make an effective forecaster with a neural network, you need to be able to properly normalize data and write a recurrent network; not a basic topic by any stretch of the imagination.

Practical problems of artificial intelligence on client side

Can anybody provide me with examples of front-end problems that could be solved by means of artificial intelligence models (neural networks, fuzzy logic, genetic algorithms)?
The only thing I've found is "Optimization of web newspaper layout in real time" (http://hera.ugr.es/doi/15001684.pdf)
I would be very pleased if you provide me with more practically relevant problems.
Well, any problem that has a wide range of possible solutions which can be discovered and optimized faster by an AI algorithm than a human...
I'll just throw some random ideas out there:
Classifying users based on user behaviours (time spent on pages, links clicked, mouse positions, all sorts of other measurable facets of user behaviour). You might want to classify them in all sorts of dimensions, the possibilities are basically endless.
Interactive simulations with agents driven using neural networks and genetic algorithms.
Classification of user drawn images.
Sentiment analysis.
You can do whatever AI stuff you want on client side. The question you should ask is when to do it client side and when to do it server side. Obviously if you want to keep your algorithms safe then don't write them in Javascript that can be viewed client side. If you need to have reliable performance, don't do it client side.

Inner workings of browser based real-time MMO games

So, suppose there was a game which consisted of a website, and a client that you can launch from said website. I've looked a bit and a relatable example would be Habbo Hotel.
What I'm asking is, what are all the different parts that would make such a game work: for the website part, I'd imagine a server, a database, and some HTML, CSS and PhP coding would be required, but how would the client side operate?
More specifically, how would the client-to-server (and vice versa) real-time communications happen?
Suppose the client be coded in C, how would the integration of C into a (I suppose PhP-framed) browser window be executed?
Note that the client is never downloaded on the user's PC, so where would it reside?
I'm sorry if these are a lot of questions, if the answers were to be too tedious to compose, feel free to just leave some documentation or tutorials (which I've looked for but haven't really been able to find), I'll happily read them on my own. Thanks in advance.
On one side your question is too broad but on the other side I can give you some pointers of how to do this in a modern way:
don't have a client, just a page in a browser
use HTML5 canvas, you may also want to look into SPA (single page application)
connect via websocket, there are HTML5 javascript implementations and PHP or node.js for the server-side
best is, use node.js on the server, PHP would be way too cumbersome
via websocket, send and receive JSON objects
host node.js on its native platform (Linux)
you may want to look into phaser as an HTML5 client-side canvas rendering framework, but it lacks many functionality and is mainly oriented towards twitch-based action games, which don't work well with this architecture because of lag
this will lead you to one conclusion: javascript is at the center of this system. you'll encounter several roadblocks, such as:
security on websockets with SSL for login
avoid SSL for real-time data (above 1 Hz)
UI on the client inside the canvas is not easy to implement, you'll have to re-invent the wheel or find a UI library for that
expect lag, the network code will take some 20%-30% overhead in respect to native C/C# code using TCP/IP or UDP (Lidgren?) and protobuf (Lidgren+protobuf) is what high-frequency AAA titles use (MMORPG or FPS alike)
From the questions you asked I sense a great lack of understanding and knowledge about the field. I guess you'll have to study some 6-12+ months beforehand. This is what I recommend, because if you start right away you'll make a lot of errors and waste your time. If above are any names you don't know about, search them and study them well. And don't start to code, there is a very steep learning curve ahead of you!
EDIT: more about server-side
If you want to implement an action-based interactive game (like an FPS or 2D shooter) I have to tell you this.
You may want to look into Unity 3D, using directly TCP/IP connections and binary messages (no HTTP, no websocket, instead protobuf).
C# (client-side) and node.js (server-side) are a good combination. For horizontal scaling you may want to look into cloud computing, docker, provisioning and a lot of server security.
But this is hostile terrain, it leads you into DevOps territory, which is way off game development. More like an architect's job. Imagine that 3-tier system (client + server + database) has a bottleneck on the server.
You want to spawn more nodes to handle more clients. This is what EVERY lobby-based game does (LoL, Overwatch, WoT, WoW instances, and so on) and what you do for partitioned maps (e.G. the "maps" in LOTRO, RIFT, many more MMORPGS). Also, to mirror (which means multiple instances of the same map to accomodate an overpopulated crowd).
To have this kind of horizontal scaling your servers must go online/offline on their own without you clicking around on command and control (e.G. puppet and similar software).
While this is the ultimate approach, it also has the most steep learning curve, especially because of security (advert DDOS, flooding, slow-loris, fake clients, and the list goes on). A new node must be "provisioned" on the fly (e.G. cloud-config) before it attaches to the cluster and goes online, so there's a whole new world of pain and learning.
The center-piece of such an elastic cloud-based server system is SSO (single sign-on).

how much data can charts js handle

For my application, I am making a get request of thousands of data points.
When I use charts js to display the data, it takes a long time to render, and I experience lag. I also noticed that the x-axis labels for each data point don't appear properly, so they had to be omitted
I like the sleek design and ui of the graphs, but cannot get it to work well for my use case. Is charts js not meant to be used with large data sets? Is there another library like charts js that can handle large data sets? While also being free?
if you want to handle big data you should use Highcharts
it easy can handle some million data without a big delay
Another option to consider is ZingChart. It is free as a branded version, but renders large amounts of data quickly while still maintaining flexibility in customization. If you are looking for a sleek design and UI, ZingChart allows the user to change just about every size, shape, and color to match your taste.
Full disclosure, I am on the ZingChart team. However, we developed a speed test tool that I think you will find helpful in testing your number of data points, regardless of which library you end up selecting. Note that some of these libraries will use up all your browser memory, so proceed with caution in some cases.
I had the same problem, Charts js seems to be unable to handle large data sets. The best alternative I've found is https://github.com/danvk/dygraphs . Also you could try http://canvasjs.com/ although it is comercial.
Have a look at LightningChart JS... It is made with WebGL. It can render
1 million data points in ~80 ms in line chart
10 million data points in ~800 ms
that is for static data. Those I got from my PC (AMD Ryzen, NVidia GTX1060)
But for scrolling streaming data, the performance is yet more impressive. Dozens of millions of points, with some configurations with Firefox browser, over 100 million points.
There is a chart performance tester application
I work with the team making this chart...

Building a geo focused app: what should I know?

I am looking forward to build an application that relies heavily on geographic data.
The application will use HTML5's ability to get GPS data and will do computations such as finding the nearest street, finding the shortest path between 2 points, etc. I was thinking of using a platform such as Google Maps, so it will most likely be written in Javascript. However, I might off load the client's CPU by doing the heavy computations server side (possibly in C++ or a scripting language).
Is there any technology, framework, standard, etc. that I should know about before I start coding?
Many SQL based relational databases have spatial awareness that can help with GPS coords.
MySQL's spatial extensions are one example. Here is an article on it. I gather if you can convert GPS data to spatially related fields then you can do things like select the nearest row to another or the first northerly row ...
Make sure to understand projections and geographic datum correction. How you do it will depend on your choice of technologies, obviously, but if you don't understand those issues they will bite you badly.
You can find my glowing review of the Google Maps API here.

Categories