JavaScript를 사용하여 진행 중인 시리즈 머신 러닝의 파트 1입니다
JAVASCRIPT? 파이썬을 사용해야 하는 거 아닌가요? 자바 스크립트로 그런 엄청난 계산을 해 보는 게 제 정신이 아닌가요? Python또는 R이 아닌 언어를 사용하여 멋지게 행동하려고 하는 것일까요?scikite-learn은 JavaScript에서도 작동하지 않습니다.
그것은 가능하고 나는 사실 개발자들이 그것이 받을 만한 관심을 주지 않았다는 것에 놀랐다. 까지scikit-learn
걱정되는 건, JS사람들이 그것에 대항하기 위해 그들만의 도서관을 만들었다는 거야, 그리고 나도 그것을 사용할 거야. 먼저, 기계 학습에 대해 조금 말씀 드리겠습니다. 얼마든지 이 로켓에 탑승해서 규정에 따라 행동하세요.
아서 사무엘에 따르면, 기계 학습은 명시적으로 프로그램되지 않고도 학습할 수 있는 능력을 컴퓨터에 제공한다. 다른 말로 하면, 사용자가 지시를 제공하지 않고도 컴퓨터가 스스로 학습하고 올바른 지시를 실행할 수 있는 능력을 제공합니다.
구글이 모바일 우선 전략에서 AI우선 전략으로 바뀌면서, 그것은 꽤 오랫동안 존재해 왔다.
JavaScript가 ML에서 언급되지 않는 이유는 무엇입니까?
- 천천히요.(MYTH!?!)
- 매트릭스 조작은 어렵다. (예를 들어 라이브러리가 있습니다.)
math.js
) - 웹 개발에만 관심이 있습니다. (어디선가 노드. js는 웃고 있다.)
- 도서관은 보통 Python을 위해 만들어진다.(JS사람들은 뒤에 있지 않다.)
JavaScript에는 LinearRegression, SVM, Naive-Bayes등과 같이 미리 생성된 시스템 학습 알고리즘을 사용하는 몇개의 라이브러리가 있습니다. 여기 그들 중 몇명이 있다.
- 뇌. js(신경 네트워크)
- 시냅틱(신경망)
- 자연(자연어 처리)
- ConvNetJS(ConvolutionalNeuralNetworks)
- mljs(다양한 함수가 있는 하위 라이브러리 집합)
- 신경 회로망(Neataptic)
- 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가 얼마나 강력한지 와 머신 러닝에 있어서 왜 뒤처지지 않아야 하는지를 다른 사람들에게 알려 주세요.
This is very interesting, You’re a very skilled blogger.
I have joined your rss feed and look forward to seeking more
of your wonderful post. Also, I’ve shared
your web site in my social networks!
Just to let you know, this content looks a little bit weird from my android phone. Who knows maybe it really is just my phone. Great post by the way.
Good post. I previousally to spend alot of my time water skiing and watching sports. It was quite possible the best sequence of my past and your content kind of reminded me of that period of my life. Cheers
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?
Blasphemy! LOL Just kidding. Ive read similar things on other blogs. Ill take your word for it. Stay solid! your pal.
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!
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.
lol, yet another site that wont display correctly in K-Melon, bugger
This blog site is pretty good. How can I make one like this !
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!
backpedal captivity Stacy cassidy quite tattered chipmunk caravan adherent
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
I’m experiencing a new short difficulty When i cant appear to be competent to join the feed, I’m using search engines readers.
Working every day by day I’m a lot more impressed by your post. Thanks for your personal efforts with expressing the following theme.
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!
Hi Really good post note. God bless, cure,invention You writers… 😉 do Have you considered promoting your blog? add it to SEO Directory right now 🙂
When I view your RSS feed it puts up a bunch of garbage, is the issue on my end?
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
I thought it was heading to become some boring aged publish, however it really compensated for my time. I will post a hyperlink to this web page on my weblog. Im positive my guests will come across that really helpful.
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!
Słowa mają ogromną moc bardzo w to wierzę. Mogą inspirować, dawać motywację lub pocieszenie, a gdy go potrzeba. Czasem w jednym zdaniu zaklęta jest mądrość, której szukamy w naszym życiu przez długi czas. Zapraszam do siebie http://www.xmc.pl 🙂
I believed it was going to become some dull aged post, but it definitely compensated for my time. Ill publish a hyperlink to this web page on my weblog. Im sure my site visitors will find that very helpful.
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.
https://newfasttadalafil.com/ – Cialis The longer the person has had decreased alertness the worse the outcome. Zdwmbw buy cialis online safely Buy Azithromycin Single Dose Qfsoxt Puxvqg Cytotec For Miscarriage Dosage https://newfasttadalafil.com/ – generic 5 mg cialis Fbgzdt