Содержание
- 2. Decision Tree functions
- 3. Функция ‘treefit’ - fit a tree-based model for classification or regression. Syntax: t = treefit(X,y) Пример:
- 4. Cluster analysis functions
- 5. Функция kmeans IDX = kmeans(X,k) [IDX,C] = kmeans(X,k) [IDX,C,sumd] = kmeans(X,k) [IDX,C,sumd,D] = kmeans(X,k) [...] =
- 6. Параметр ‘distance’ 'sqEuclidean‘ - Squared Euclidean distance (default). 'cityblock‘ - Sum of absolute differences, i.e., L1.
- 7. Параметр ‘start’ Method used to choose the initial cluster centroid positions, sometimes known as "seeds". Valid
- 8. Classification load fisheriris; gscatter(meas(:,1), meas(:,2), species,'rgb','osd'); xlabel('Sepal length'); ylabel('Sepal width');
- 9. Linear and quadratic discriminant analysis linclass = classify(meas(:,1:2), meas(:,1:2),species); bad = ~strcmp(linclass,species); numobs = size(meas,1); pbad
- 10. Visualization regioning the plane [x,y] = meshgrid(4:.1:8,2:.1:4.5); x = x(:); y = y(:); j = classify([x
- 11. Decision trees tree = treefit(meas(:,1:2), species); [dtnum,dtnode,dtclass] = treeval(tree, meas(:,1:2)); bad = ~strcmp(dtclass,species); sum(bad) / numobs
- 12. Iris classification tree
- 13. Тестирование качества классификации resubcost = treetest(tree,'resub'); [cost,secost,ntermnodes,bestlevel] = treetest(tree,'cross',meas(:,1:2),species); plot(ntermnodes,cost,'b-', ntermnodes,resubcost,'r--') figure(gcf); xlabel('Number of terminal nodes');
- 14. Выбор уровня [mincost,minloc] = min(cost); cutoff = mincost + secost(minloc); hold on plot([0 20], [cutoff cutoff],
- 15. Оптимальное дерево классификации prunedtree = treeprune(tree,bestlevel); treedisp(prunedtree) cost(bestlevel+1) >> ans = 0.22
- 17. Скачать презентацию