-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


[]

, 08 2017 . 09:39 +


-: 60 FPS , , , .

- ? .

, , . , . , ( ) .


, , .

, , , , , .

.

-, 674 , , , , ( : ).

-, , / / , 12 .

, 12 , . , 12 , ?

: 12 12 , .

, , , , .

, , 12 , reddit.


, , , ?

  • Machine Learning.
  • .
  • Amazon Machine Learning.
  • , .
  • .

,


ML- Amazon. , ~ 5 , .

:

  • CSV-. (, ), , , .
  • AWS S3.
  • ( ). , , .
  • , / / , , ( Amazon) .


, .

. , .

:



:



, !

, ?

( React/Redux, jQuery, MobX, RxJS, Bluebird, Bootstrap, Sass, Compass, NodeJS, Express Lodash. WebPack . 1 MB #perfwin).

, .

, - . , 10 000 . , , URL- DOM CSV. : , .

CSV S3 , . CPU 3 .

, , , , ,.



, .

API Amazon , . Node-.

-


. API , .

const AWS = require('aws-sdk');

const machineLearning = new AWS.MachineLearning();

const params = {
  MLModelId: 'some-model-id',
  PredictEndpoint: 'some-endpoint',
  Record: {},
};

machineLearning.predict(params, (err, prediction) => {
  //    !
});

record, , Record, JSON, , (, ).

, server.js, /predict:

const express = require('express');
const bodyParser = require('body-parser');
const AWS = require('aws-sdk');

const app = express();
app.use(express.static('public'));
app.use(bodyParser.json());

AWS.config.loadFromPath('./private/aws-credentials.json');

const machineLearning = new AWS.MachineLearning();

app.post('/predict', (req, res) => {
  const params = {
    MLModelId: 'my-model-id',
    PredictEndpoint: 'https://realtime.machinelearning.us-east-1.amazonaws.com',
    Record: req.body,
  };

  machineLearning.predict(params, (err, data) => {
    if (err) {
      console.log(err);
    } else {
      res.json({ category: data.Prediction.predictedLabel });
    }
  });
});

app.listen(8080);

aws-credentials.json:

const express = require('express');
const bodyParser = require('body-parser');
const AWS = require('aws-sdk');

const app = express();
app.use(express.static('public'));
app.use(bodyParser.json());

AWS.config.loadFromPath('./private/aws-credentials.json');

const machineLearning = new AWS.MachineLearning();

app.post('/predict', (req, res) => {
  const params = {
    MLModelId: 'my-model-id',
    PredictEndpoint: 'https://realtime.machinelearning.us-east-1.amazonaws.com',
    Record: req.body,
  };

  machineLearning.predict(params, (err, data) => {
    if (err) {
      console.log(err);
    } else {
      res.json({ category: data.Prediction.predictedLabel });
    }
  });
});

app.listen(8080);

(, /private .gitignore, .)

, c .

-


, , . :

  • blur .
  • .
  • POST- /predict, .
  • .


(function() {
  const titleEl = document.getElementById('title-input');
  const descriptionEl = document.getElementById('desc-input');
  const priceEl = document.getElementById('price-input');
  const catSuggestionsEl = document.getElementById('cat-suggestions');
  const catSuggestionEl = document.getElementById('suggested-category');

  function predictCategory() {
    const fetchOptions = {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        title: titleEl.value,
        description: descriptionEl.value,
        price: priceEl.value,
      })
    };

    fetch('/predict', fetchOptions)
      .then(response => response.json())
      .then(prediction => {
        catSuggestionEl.textContent = prediction.category;
        catSuggestionsEl.style.display = 'block';
      });
  }

  document.querySelectorAll('.user-input').forEach(el => {
    el.addEventListener('blur', predictCategory);
  });
})();

. 100% , , , .


,

, ( 10 000 / 4 ), 6,3 . , , 6,3 . $0,0001 / . . $0,0001. .

, Amazon, . Google TensorFlow, . Microsoft . Microsoft Azure Machine Learning Amazon. , / , . , 11 Amazon, 23 Azure. , , -.

?


, , . , . . , , .

, , . , , .
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/335122/

:  

: [1] []
 

:
: 

: ( )

:

  URL