JavaScript를 이용한 머신 러닝:파트 1

JavaScript를 사용하여 진행 중인 시리즈 머신 러닝의 파트 1입니다

JAVASCRIPT? 파이썬을 사용해야 하는 거 아닌가요? 자바 스크립트로 그런 엄청난 계산을 해 보는 게 제 정신이 아닌가요? Python또는 R이 아닌 언어를 사용하여 멋지게 행동하려고 하는 것일까요?scikite-learn은 JavaScript에서도 작동하지 않습니다. 

그것은 가능하고 나는 사실 개발자들이 그것이 받을 만한 관심을 주지 않았다는 것에 놀랐다. 까지scikit-learn걱정되는 건, JS사람들이 그것에 대항하기 위해 그들만의 도서관을 만들었다는 거야, 그리고 나도 그것을 사용할 거야. 먼저, 기계 학습에 대해 조금 말씀 드리겠습니다. 얼마든지 이 로켓에 탑승해서 규정에 따라 행동하세요.

아서 사무엘에 따르면, 기계 학습은 명시적으로 프로그램되지 않고도 학습할 수 있는 능력을 컴퓨터에 제공한다. 다른 말로 하면, 사용자가 지시를 제공하지 않고도 컴퓨터가 스스로 학습하고 올바른 지시를 실행할 수 있는 능력을 제공합니다.

구글이 모바일 우선 전략에서 AI우선 전략으로 바뀌면서, 그것은 꽤 오랫동안 존재해 왔다.

JavaScript가 ML에서 언급되지 않는 이유는 무엇입니까?

  1. 천천히요.(MYTH!?!)
  2. 매트릭스 조작은 어렵다. (예를 들어 라이브러리가 있습니다.)math.js)
  3. 웹 개발에만 관심이 있습니다. (어디선가 노드js는 웃고 있다.)
  4. 도서관은 보통 Python을 위해 만들어진다.(JS사람들은 뒤에 있지 않다.)

JavaScript에는 LinearRegression, SVM, Naive-Bayes등과 같이 미리 생성된 시스템 학습 알고리즘을 사용하는 몇개의 라이브러리가 있습니다. 여기 그들 중 몇명이 있다.

  1. 뇌. js(신경 네트워크)
  2. 시냅틱(신경망)
  3. 자연(자연어 처리)
  4. ConvNetJS(ConvolutionalNeuralNetworks)
  5. mljs(다양한 함수가 있는 하위 라이브러리 집합)
  6. 신경 회로망(Neataptic)
  7. Wembnn( 깊은 학습

우리는 mljs의 회귀 라이브러리를 사용하여 선형 회귀 주술을 수행할 것이다. 모든 코드는 기투브에 있다:머신 러닝(machine-learning)-js

1단계. 라이브러리 설치

$style추가ml-regressioncsvtojson

아니면 네가 좋아한다면npm

$npm installinstall-regressioncsvtojson

ml-regression그 이름이 의미하는 바를 하는 겁니다

csvtojson는 로드를 허용하는 node.js의 빠른 csv구문 분석기입니다.csv데이터 파일 및 변환 대상JSON.

2단계. 라이브러리 초기화 및 데이터 로드

여기에서 데이터 파일(. csv)을 다운로드하여 프로젝트에 넣으십시오.

빈 npm 프로젝트를 이미 초기화한 경우index.js파일을 작성하고 다음을 입력합니다. ( 원한다면 복사/ 붙여 넣기를 할 수도 있지만, 더 나은 이해를 위해 직접 입력하는 것이 좋습니다.)

파일을 프로젝트의 루트에 배치했습니다. 그러니 다른 곳에 저장해 두었다면 업데이트를 해 주세요.csvFilePath마찬가지로 변수가 있습니다.

꽤 깔끔하죠?

이제 우리는 다음과 같은 것을 사용할 것이다.fromFile의 방법.csvtojson데이터 파일을 로드할 수 있습니다.

3단계. 실행 준비를 위해 데이터 드레싱

우리가 저장한 JSON개체csvData객체, 입력 데이터 포인트와 출력 데이터 포인트의 배열이 필요합니다. 데이터를 검색할 예정입니다.dressData우리를 채울 함수X그리고.y변수들

4단계. 모델을 훈련하고 예측하기 시작합니다.

이제 데이터를 성공적으로 처리했으므로 이제 모델을 교육할 때입니다.

이것을 위해, 우리는 글을 쓸 것이다.performRegression기능:

regressionModel방법이 있다toString부동 소수 점 출력에 대해 정밀도라는 매개 변수를 사용합니다.

predictOutput함수를 사용하면 입력 값을 입력하고 예측된 출력을 콘솔로 출력할 수 있습니다.

다음과 같은 방법으로 표시됩니다.(노드. jsjsreadline유틸리티를 사용하고 있습니다.)

다음은 읽기 사용자 입력을 추가하기 위한 코드입니다.

5단계. 만세! 당신이 해냈어요. 등 뒤를 쓰다듬어 보세요.

이 단계를 수행한 경우 index.js의 모양은 다음과 같습니다.

터미널로 이동하여 실행node index.js다음과 같은 결과를 얻을 수 있습니다.

$nodeindex.js
f(x)=0.202*x+9.31
예측을 위해 X입력(CTRL+C를 눌러 종료):151.5
X=151.5에서 y=39.98974927911285
예측을 위해 입력 X를 입력합니다(종료하려면 CTRL+C를 누르십시오).

축하해요. 방금 자바 스크립트에서 첫번째 선형 회귀 모형을 교육했습니다.(속도를 알고 계십니까?)

ml다양한 데이터 세트에서 인기 있는 기계 학습 알고리즘을 실행하기 위한 기타 라이브러리(위에 나열됨!). 내 프로필을 잘 봐, 그렇지 않으면 여유를 가지고 날 따라와. 🙂

읽어 줘서 고마워! 만약 여러분이 그것이 마음에 들었다면녹색 버튼을 눌러 JS가 얼마나 강력한지 와 머신 러닝에 있어서 왜 뒤처지지 않아야 하는지를 다른 사람들에게 알려 주세요.

24 thoughts on “JavaScript를 이용한 머신 러닝:파트 1”

  1. Ive been exploring on the net hoping to get some ideas on the way to get my personal weblog coded, your present style together with style are wonderful. Did you code it by yourself or did you recruit a coder to do it on your behalf?

    응답
  2. This is by far the best looking site I’ve seen! It was completely easy to navigate and it was easy to look for the information I needed! Fantastic layout and great content!! Every site should have that!

    응답
  3. This was a truly very great post. In theory I’d wish to create like this also – getting time and actual effort to make a terrific piece of writing but what can I say I procrastinate alot and by no means appear to obtain anything done.

    응답
  4. Hi there! This is my 1st comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading your blog posts. Can you recommend any other blogs/websites/forums that deal with the same subjects? Thank you!

    응답
  5. First of all, allow my family recognize a persons command during this matter. Even though this is certainly brand new , nevertheless soon after registering your site, this intellect has exploded extensively. Allow all of us to take hold of ones rss to help keep in touch with at all probable messages Sincere understand but will pass it on to help admirers and my individual are living members

    응답
  6. I wanted to say Thank You for providing this information, youre doing a great job with the site if you get a chance would you help me make some changes to my site? Ill pay you for your help, you can find the link to my site in my name. Thank you!

    응답
  7. Just want to say your blog is very good. I always like to hear something new about this because I have the similar blog in my Country on this subject so this help´s me a lot. I did a search on the issue and found a good number of blogs but nothing like this.Thanks for sharing so much in your blog.. Greets, Darijan

    응답
  8. An impressive share, I just given this onto a co-worker who was doing a little analysis on this. And he in fact bought me breakfast because I found it for him. smile. So let me reword that: Thank you for the treat! But yeah Thanks for spending the time to discuss this, I feel strongly about it and enjoy learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more info? It is extremely helpful for me. Two thumb up for this post!

    응답
  9. This was a really really good post. In theory I’d like to publish like this also – getting time and actual effort to make a fantastic piece of writing but what can I say I procrastinate alot and by no means appear to obtain one thing done.

    응답

Leave a Comment