楼主: ReneeBK
7847 40

Machine Learning Projects for .NET Developers Apress 2015 [推广有奖]

  • 1关注
  • 62粉丝

VIP

学术权威

14%

还不是VIP/贵宾

-

TA的文库  其他...

R资源总汇

Panel Data Analysis

Experimental Design

威望
1
论坛币
49407 个
通用积分
51.8104
学术水平
370 点
热心指数
273 点
信用等级
335 点
经验
57815 点
帖子
4006
精华
21
在线时间
582 小时
注册时间
2005-5-8
最后登录
2023-11-26

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

Machine Learning Projects for .NET Developers


Book Description
Machine Learning Projects for .NET Developers shows you how to build smarter .NET applications that learn from data, using simple algorithms and techniques that can be applied to a wide range of real-world problems. You'll code each project in the familiar setting of Visual Studio, while the machine learning logic uses F#, a language ideally suited to machine learning applications in .NET. If you're new to F#, this book will give you everything you need to get started. If you're already familiar with F#, this is your chance to put the language into action in an exciting new context.

Along the way, you'll learn fundamental ideas that can be applied in all kinds of real-world contexts and industries, from advertising to finance, medicine, and scientific research. While some machine learning algorithms use fairly advanced mathematics, this book focuses on simple but effective approaches. If you enjoy hacking code and data, this book is for you.
Book Details
Publisher:        Apress
By:        Mathias Brandewinder
ISBN:        978-1-4302-6767-6
Year:        2015
Pages:        300
Language:        English
File size:        7.5 MB
File format:        PDF
eBook
Download:        Machine Learning Projects for .NET Developers

二维码

扫码加我 拉你入群

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

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

关键词:Developers developer Learning Projects earning techniques learning familiar problems machine

回帖推荐

Lisrelchen 发表于3楼  查看完整内容

**** 本内容被作者隐藏 ****
已有 2 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
yyj_1976 + 60 + 2 + 2 + 2 精彩帖子
我的素质低 + 100 + 40 + 3 + 3 + 3 精彩帖子

总评分: 经验 + 160  论坛币 + 40  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

本帖被以下文库推荐

沙发
Lisrelchen 发表于 2015-8-2 23:07:02 |只看作者 |坛友微信交流群

Listing 2-1. Reading the SMS dataset from the file

  1. Listing 2-1. Reading the SMS dataset from the file
  2. open System.IO
  3. type DocType =
  4. | Ham
  5. | Spam
  6. let parseDocType (label:string) =
  7. match label with
  8. | "ham" -> Ham
  9. | "spam" -> Spam
  10. | _ -> failwith "Unknown label"
  11. let parseLine (line:string) =
  12. let split = line.Split('\t')
  13. let label = split.[0] |> parseDocType
  14. let message = split.[1]
  15. (label, message)
  16. Let fileName = "SMSSpamCollection"
  17. let path = __SOURCE_DIRECTORY__ + @"..\..\Data\" + fileName
  18. let dataset =
  19. File.ReadAllLines path
  20. |> Array.map parseLine
  21. At this point, you should be able to select the entire code you just wrote in the script file and execute it
  22. in F# Interactive, which will produce the following:
  23. val dataset : (DocType * string) [] =
  24. [|(Ham,
  25. "Go until jurong point, crazy.. Available only in bugis n grea"+[50 chars]);
  26. (Ham, "Ok lar... Joking wif u oni...");
  27. (Spam,
  28. "Free entry in 2 a wkly comp to win FA Cup final tkts 21st May"+[94 chars]);
  29. // Snipped for brevity
  30. (Ham,
  31. "Hi. Wk been ok - on hols now! Yes on for a bit of a run. Forg"+[117 chars]);
  32. (Ham, "I see a cup of coffee animation"); ...|]
复制代码

使用道具

藤椅
Lisrelchen 发表于 2015-8-2 23:11:48 |只看作者 |坛友微信交流群

本帖隐藏的内容

Machine Learning Projects for .NET Developers.rar (5.51 MB, 需要: 20 个论坛币) 本附件包括:
  • Machine Learning Projects for .NET Developers.pdf

使用道具

板凳
Lisrelchen 发表于 2015-8-2 23:13:34 |只看作者 |坛友微信交流群

Listing 2-2. Scoring a document

Assuming a document has already been broken into a set of tokens, computing its score for a given group is fairly simple. We don’t have to worry about how these numbers have been computed. If that part has been done already, all we need to do is sum up the log of the group frequency, as well as the log of every token that is present in both the tokenized document and the list of tokens we are using in our model:
  1. Listing 2-2. Scoring a document
  2. let tokenScore (group:DocsGroup) (token:Token) =
  3. if group.TokenFrequencies.ContainsKey token
  4. then log group.TokenFrequencies.[token]
  5. else 0.0
  6. let score (document:TokenizedDoc) (group:DocsGroup) =
  7. let scoreToken = tokenScore group
  8. log group.Proportion +
  9. (document |> Seq.sumBy scoreToken)
复制代码

使用道具

报纸
Lisrelchen 发表于 2015-8-2 23:18:26 |只看作者 |坛友微信交流群

Listing 2-3. Predicting the label of a document

  1. Listing 2-3. Predicting the label of a document
  2. let classify (groups:(_*DocsGroup)[])
  3. (tokenizer:Tokenizer)
  4. (txt:string) =
  5. let tokenized = tokenizer txt
  6. groups
  7. |> Array.maxBy (fun (label,group) ->
  8. score tokenized group)
  9. |> fst
复制代码

使用道具

地板
Lisrelchen 发表于 2015-8-2 23:20:25 |只看作者 |坛友微信交流群

Listing 2-4. Analyzing a group of documents

  1. Listing 2-4. Analyzing a group of documents
  2. let analyze (group:TokenizedDoc seq)
  3. (totalDocs:int)
  4. (classificationTokens:Token Set)=
  5. let groupSize = group |> Seq.length
  6. let score token =
  7. let count = countIn group token
  8. laplace count groupSize
  9. let scoredTokens =
  10. classificationTokens
  11. |> Set.map (fun token -> token, score token)
  12. |> Map.ofSeq
  13. let groupProportion = proportion groupSize totalDocs
  14. {
  15. Proportion = groupProportion
  16. TokenFrequencies = scoredTokens
  17. }
复制代码

使用道具

7
Lisrelchen 发表于 2015-8-2 23:22:30 |只看作者 |坛友微信交流群

Listing 2-5. Learning from documents

  1. Listing 2-5. Learning from documents
  2. let learn (docs:(_ * string)[])
  3. (tokenizer:Tokenizer)
  4. (classificationTokens:Token Set) =
  5. let total = docs.Length
  6. docs
  7. |> Array.map (fun (label,docs) -> label,tokenizer docs)
  8. |> Seq.groupBy fst
  9. |> Seq.map (fun (label,group) -> label,group |> Seq.map snd)
  10. |> Seq.map (fun (label,group) -> label,analyze group total classificationTokens)
  11. |> Seq.toArray
复制代码

使用道具

8
Lisrelchen 发表于 2015-8-2 23:24:44 |只看作者 |坛友微信交流群

Listing 2-6. Training a naïve Bayes classifier

  1. Listing 2-6. Training a naïve Bayes classifier
  2. let train (docs:(_ * string)[])
  3. (tokenizer:Tokenizer)
  4. (classificationTokens:Token Set) =
  5. let groups = learn docs tokenizer classificationTokens
  6. let classifier = classify groups tokenizer
  7. classifier
复制代码

使用道具

9
Lisrelchen 发表于 2015-8-2 23:29:27 |只看作者 |坛友微信交流群

Listing 2-7. Using regular expressions to tokenize a line of text

  1. Listing 2-7. Using regular expressions to tokenize a line of text
  2. open System.Text.RegularExpressions
  3. let matchWords = Regex(@"\w+")
  4. let tokens (text:string) =
  5. text.ToLowerInvariant()
  6. |> matchWords.Matches
  7. |> Seq.cast<Match>
  8. |> Seq.map (fun m -> m.Value)
  9. |> Set.ofSeq
复制代码

使用道具

10
Lisrelchen 发表于 2015-8-2 23:31:00 |只看作者 |坛友微信交流群

Listing 2-8. A generic model-evaluation function

  1. Listing 2-8. A generic model-evaluation function
  2. let evaluate (tokenizer:Tokenizer) (tokens:Token Set) =
  3. let classifier = train training tokenizer tokens
  4. validation
  5. |> Seq.averageBy (fun (docType,sms) ->
  6. if docType = classifier sms then 1.0 else 0.0)
  7. |> printfn "Correctly classified: %.3f"
  8. Evaluating a particular model then becomes a one-liner:
  9. > evaluate wordTokenizer allTokens;;
复制代码

使用道具

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

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-26 08:51