Wolfram 機器學習 | 值得嘗試的事情
Wolfram 機器學習 | 值得嘗試的事情
透過點擊程式碼內部並按下 可以編輯並執行任何程式碼.
+
機器學習與神經網路。從生產級經典機器學習到現代人工智能,與統計分析、視覺化、圖像處理等深度整合以及構建智能系統。
使用和訓練分類器
使用和訓練分類器
使用預先訓練的分類器辨識圖像: |
Classify"NotablePerson",
對文字使用預先訓練的語言分類器: |
Classify["Language","the house is blue","la maison est bleue","la casa es azul","das Haus ist blau","房子是蓝色的","المنزل باللون الأزرق","будинок синій"]
預先訓練的模型用於許多其他功能: |
ImageIdentify
,
,
,SpecificityGoal->"Low"
使用高階代碼訓練自己的分類器: |
topicClassifier=Classify"the cat is grey"->
,"my cat is fast"->
,"this dog is scary"->
,"the big dog"->
使用訓練好的模型: |
topicClassifier[{"nice cat","what a dog"}]
聚類分析
聚類分析
尋找資料中的聚類: |
ListPlotFindClusters
指定方法和其他選項以獲得更好的控制: |
ListPlotFindClusters,Method->"DBSCAN"
根據圖形内容分析聚類: |
CommunityGraphPlot[ExampleData[{"NetworkGraph","JazzMusicians"}]]
分析圖像中的元件: |
ClusteringComponents
,7//Colorize
降維
降維
顏色函數顯示資料結構可以嵌入到較低維度空間: |
ListPointPlot3D,ColorFunction->Hue0.5-0.5
Total[]
&,ColorFunctionScaling->False,2
{#1,#2}
為此資料集建立一個降維函數: |
dr=DimensionReduction,Method->"Isomap"
對資料套用降維函數: |
ListPlotdr,ColorFunction(Hue[0.5#1]&)
偵測異常資料
偵測異常資料
從經典資料集中檢索資訊: |
In[]:=
irisdata=ResourceData["Sample Data: Fisher's Irises"][All,{"PetalLength","SepalWidth"},QuantityMagnitude];
建立異常偵測函數: |
detector=AnomalyDetection[irisdata]
使用檢測器函數尋找資料集中的異常: |
anomalies=FindAnomalies[detector,irisdata]
視覺化資料和決策邊界: |
ShowContourPlotdetector[{x,y},"RarerProbability"],{x,-1,9},{y,1,5},,ListPlot{irisdata,anomalies},
缺失資料的估算值
缺失資料的估算值
透過移除資料集中的某些資訊來模擬遺失的資料: |
incompletedata=/.{x_/;4<x<5,y_}:>{x,Missing[]};ListPlot[incompletedata]
訓練一個分佈來預測遺失值: |
{nonmissingdata,missingdata}=GatherBy[incompletedata,MemberQ[_Missing]];ld=LearnDistribution[nonmissingdata]
合成缺失值並繪製結果: |
synthesized=SynthesizeMissingValues[ld,missingdata];ListPlot[{incompletedata,synthesized}]
訓練和研究神經網路
訓練和研究神經網路
檢索經典資料集進行分類: |
In[]:=
trainingdata=ResourceData["MNIST","TrainingData"];testdata=ResourceData["MNIST","TestData"];SeedRandom[1234];RandomSample[trainingdata,5]
Out[]=
9,
4,
0,
2,
5
在資料上訓練模型 (可能需要較長時間運算): |
In[]:=
trainedNet=NetTrain[NetModel["LeNet"],trainingdata,MaxTrainingRounds->2]
Out[]=
NetChain
看看受過訓練的網路表現: |
NetMeasurements[trainedNet,testdata,{"Accuracy","ConfusionMatrixPlot"}]
Out[]=
0.9889,
actual class | |
| predicted class |
電腦視覺
電腦視覺
自然語言處理
自然語言處理
語音分析
語音分析