楼主: Lisrelchen
958 6

【博文】Machine Learning in Javascript: Introduction [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50288 个
通用积分
83.6306
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2017-4-16 01:16:14 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
Machine Learning in Javascript: Introduction
  1. Machine Learning in Javascript: Introduction
  2. 5 years ago
  3. ML in JS
  4. I love machine learning algorithms. I've taught classes and seminars and given talks on ML. The subject is fascinating to me, but like all skills fascination simply isn't enough. To get good at something, you need to practice!

  5. I also happen to be a PHP and JavaScript developer. I've taught classes on both of these as well -- but like any decent software engineer I have experience with Ruby, Python, Perl, and C. I just prefer PHP and JS. (Before you flame PHP, I'll just say that while it has its problems, I like it because it gets stuff done.)

  6. Whenever I say that Tidal Labs' ML algorithms are in PHP, they look at me funny and ask me how it's possible. Simple: it's possible to write ML algorithms in just about any language. Most people just don't care to learn the fundamentals strongly enough that they can write an algorithm from scratch. Instead, they rely on Python libraries to do the work for them, and end up not truly grasping what's happening inside the black box. Other people only know ML academically, using Octave or Matlab.

  7. Through this series of articles, I'll teach you the fundamental machine learning algorithms using Javascript -- not Python or Octave -- as the example language. Originally I intended to write these articles in a variety of languages (PHP, JS, Perl, C, Ruby), but decided to stick with Javascript for the following reasons:

  8. If you're a web developer you probably already know JS, regardless of your backend expertise.
  9. Javascript has JSFiddle, a great tool that lets me embed executable Javascript right in my posts (hard to do that with C or Perl!)
  10. Several people asked me to stick to just one language.
  11. While I'll be writing these articles with Javascript in mind, please re-write the examples in your language of choice as homework! Practice is how you get better, and writing the same algorithm several times in different languages really helps you understand the paradigms better.

  12. It's possible to get excellent performance out of ML algorithms in languages like PHP and Javascript. I advocate writing ML algorithms in other languages because the practice of writing ML algorithms from scratch helps you learn them fundamentally, and it also helps you unify your backend by not requiring a Python script to do processing in the middle of a PHP application. You can do it in PHP, and cut out the (mental and computational) overhead of using another language.

  13. ... well, most of the time. There are some things you really can't do in PHP or Javascript, but those are the more advanced algorithms that require heavy matrix math. While you can do matrix math in JS, there is a big difference between simply "doing matrix math" and doing it efficiently. The advantage of NumPy or Matlab is not in their ability to do matrix operations, it's in the fact that they use optimized algorithms to do so -- things you wouldn't be able to do yourself unless you dedicate yourself to learning computational linear algebra. And that's not my field, so we'll just stick to the ML that doesn't require the advanced matrix math. You could try brute-forcing the matrix operations, but you'll end up with a relatively inefficient system. It's great for learning, so I'm not discouraging it -- I would just be wary of doing that in a production environment.

  14. Keep in mind that most of the algorithms we'll look at can be solved both with and without matrix math. We'll use iterative or functional approaches here, but most of these algorithms can be done with linear algebra as well. There's more than one way to skin a cat! I encourage you to also go and learn (or figure out) the linear algebra approaches, but since that's not my strong suit I'll use other approaches.

  15. Here are some of the algorithms I intend to cover. I'll update this list with links to the relevant articles as they're published:

  16. k-nearest-neighbor (Introduction)
  17. k-means clustering (Part 1)
  18. Genetic algorithms (Part 1, Part 2)
  19. Naive Bayes classifier (Part 1: Document Classification)
  20. Sentiment Analysis (Part 1)
  21. Full-text Search (Part 1: Relevance Scoring)
  22. Neural network
复制代码

本帖隐藏的内容

https://www.burakkanber.com/blog/machine-learning-in-other-languages-introduction/



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:introduction troduction Javascript Learning machine

沙发
auirzxp 学生认证  发表于 2017-4-16 01:37:04
提示: 作者被禁止或删除 内容自动屏蔽

藤椅
MouJack007 发表于 2017-4-16 03:49:19
谢谢楼主分享!

板凳
MouJack007 发表于 2017-4-16 03:49:35

报纸
ReneeBK 发表于 2017-4-16 03:58:01
  1. Bayes.train = function (text, label) {  
  2.     registerLabel(label);
  3.     var words = tokenize(text);
  4.     var length = words.length;
  5.     for (var i = 0; i < length; i++)
  6.         incrementStem(words[i], label);
  7.     incrementDocCount(label);
  8. };
复制代码

http://burakkanber.com/blog/machine-learning-naive-bayes-1/

地板
ReneeBK 发表于 2017-4-16 03:59:28
  1. var tokenize = function (text) {  
  2.     text = text.toLowerCase().replace(/\W/g, ' ').replace(/\s+/g, ' ').trim().split(' ').unique();
  3.     return text;
  4. };
  5. In this case, we use unique() because we're only interested in whether a word shows up in a document, and not the number of times it shows up. In certain situations, you may get better results by considering the number of times a word appears in a document.

  6. We then loop through each word (or "token"), and call incrementStem on it. This function is also very simple: it just records the number of times a word was seen for a given label.

  7. Finally, we call incrementDocCount, which records how many documents we've seen for a given label.
复制代码

7
franky_sas 发表于 2017-4-16 13:41:59

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-31 08:54