code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
load("rec.dat");
load("tstl.dat");
stats=[rec, tstl];
scores=[];
iterations = 10;
startTime = cputime;
confidenceLevel=0.44;
for(trial=1:iterations)
[trainSet testSet] = splitSet(stats, 0.5);
credibilityMatrix = getPerformanceMatrix(trainSet);
[testAnswers confide... | 12l-rob-lab | trunk/lab7/src/initNaive.m | MATLAB | gpl3 | 1,047 |
#assumes rows do not contain label
function [result confidence] = maxCredibilityAnswer(rows, cm, handicap=0.008)
result=zeros(size(rows,1),1);
confidence=[];
credibilities = zeros(size(rows));
for(row=1:size(rows,1))
for(classifier=1:size(rows,2))
credibilities(row,classifier)=cm(rows(row,classifier)+1,classif... | 12l-rob-lab | trunk/lab7/src/maxCredibilityAnswer.m | MATLAB | gpl3 | 854 |
function matrices = getConfusionMatrices(res, lab)
uniqueLabels = unique(lab);
matrices = {};
for(clf=1:size(res,2))
cm=zeros(size(uniqueLabels,1),size(uniqueLabels,1)+1);
for(row=1:size(lab,1))
cm(lab(row,1)+1,res(row,clf)+1)+=1;
end;
matrices{size(matrices,2)+1}=cm;
end;
end;
| 12l-rob-lab | trunk/lab7/src/getConfusionMatrices.m | MATLAB | gpl3 | 294 |
function [trainSet testSet] = splitSet(set, ratio=0.5)
order = randperm(size(set,1));
divPt=floor(size(order,2)*ratio);
trainSet=set(order(1:divPt),:);
testSet=set(order(divPt+1:end),:);
end;
| 12l-rob-lab | trunk/lab7/src/splitSet.m | MATLAB | gpl3 | 197 |
\documentclass{article}
\usepackage{polski}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage[usenames,dvipsnames]{color} % For colors and names
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tabularx}
\title{Laboratorium Rozpoznawania Obrazów \\ ćwiczenie 7: poprawa jakości rozpoznawania } % Title
... | 12l-rob-lab | trunk/lab7/doc/report.tex | TeX | gpl3 | 7,929 |
\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}Uruchamianie implementacji}{1}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Opis metod sk\IeC {\l }adania wynik\IeC {\'o}w pojedynczych klasyfikator\IeC {\'o}w}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Metaklasyfikator B... | 12l-rob-lab | trunk/lab7/doc/report.aux | TeX | gpl3 | 1,106 |
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
load("rec.dat");
load("tstl.dat");
stats=[rec, tstl];
scores=[];
iterations = 3;
startTime = cputime;
confidenceLevel=0.925;
#a quick test over the test set
allCm = getConfusionMatrices(rec, tstl);
[allAns allConf] = bayesianMeta(rec, allCm, 0.000001);
allAns(allConf<co... | 12l-rob-lab | trunk/lab7/initBayesianMeta.m | MATLAB | gpl3 | 1,281 |
#generates a matrix of std dev values in classes
# attr1 attr2 attr3 attr4 ...
#class1
#class2
#class3
#class4
function S = getStdevs(data)
S=[];
for i=1:4
subset=data(data(:,1)==i,2:end);
S=[S;sqrt(var(subset))];
end;
end
| 12l-rob-lab | trunk/lab2/src/getStdevs.m | MATLAB | gpl3 | 265 |
#Parzen window classifier
#result matrix contains two rows: 1st: occurencies of each class in the testset, 2nd: classification errors within each class
#
#train - matrix of samples(rows) and their relevant attributes (cols) prepended by class id (1st col)
#test - same as above
#apriori
#width - width of parzen window... | 12l-rob-lab | trunk/lab2/src/coreTask3.m | M | gpl3 | 839 |
#returns the value of the window function for given u
function w = window(u)
w=(exp(-1*pow2(u)/2))/(sqrt(2*pi));
end;
| 12l-rob-lab | trunk/lab2/src/window.m | MATLAB | gpl3 | 122 |
#generates a matrix of mean values in classes
# attr1 attr2 attr3 attr4 ...
#class1
#class2
#class3
#class4
function M = getMeans(data)
M=[];
for i=1:4
subset=data(data(:,1)==i,2:end);
M=[M;mean(subset)];
end;
end
| 12l-rob-lab | trunk/lab2/src/getMeans.m | M | gpl3 | 257 |
#testdata row: class, param1, param2
#errorRate row: [c1,c2,c3,c4] (error rates in respective classes)
function results = performTest(testdata,M,S,apriori=[0.25,0.25,0.25,0.25])
mistakes=[0,0,0,0];
occurencies=[0,0,0,0];
for i=1:size(testdata,1)
occurencies(1,testdata(i,1))+=1;
answer=guessC... | 12l-rob-lab | trunk/lab2/src/performTest.m | MATLAB | gpl3 | 491 |
#Classifier based on attributes independence assumption
#given training and testsets reduced to meaningful columns: [ classNo, attr, attr, ...., attr ]
#result matrix contains two rows: 1st: occurencies of each class in the testset, 2nd: classification errors within each class
#
#train - matrix of samples(rows) and th... | 12l-rob-lab | trunk/lab2/src/coreTask1.m | M | gpl3 | 598 |
# tells the class [1-4] of a given sample
#M - matrix of mean values of all traits (columns) in particular classes (rows)
#S - matrix of std dev values of all traits (columns) in particular classes (rows)
#sample - vector of attributes to clasify upon (1 row)
function classNo = guessClass(sample,M,S,apriori=[0.25,0.25,... | 12l-rob-lab | trunk/lab2/src/guessClass.m | MATLAB | gpl3 | 541 |
#returns the length of the difference of given vectors
function d = distance(a,b)
d=sqrt((a-b)*(a-b)');
end;
| 12l-rob-lab | trunk/lab2/src/distance.m | MATLAB | gpl3 | 113 |
#batch execution wrapper
# fname = coreTask1 || coreTask2 || coreTask3
#p1 - minimum size of attributes subset
#p2 - maximum size of attributes subset
function launcher(fname,train, test, p1,p2,attr_range_begin=2,attr_range_end=8,window_widths=[0.01,0.001,0.0001])
apriori=[];
for(i=1:4)
apriori(1,i)=si... | 12l-rob-lab | trunk/lab2/src/launcher.m | MATLAB | gpl3 | 1,665 |
#dataset reduction function.
#source - input dataset
#factor - (0;1) scaling factor
#apriori - desired output a priori probabilites for classes 1-4
function M = reduceSet(source,factor,apriori=[0.25,0.25,0.25,0.25])
M=[];
total = size(source,1);
for i=1:4
temp=source(source(:,1)==i,:);
temp=... | 12l-rob-lab | trunk/lab2/src/reduceSet.m | M | gpl3 | 447 |
#Classifier using multidimensional probability densities
#given training and testsets reduced to meaningful columns: [ classNo, attr, attr, ...., attr ]
#result matrix contains two rows: 1st: occurencies of each class in the testset, 2nd: classification errors within each class
#
#train - matrix of samples(rows) and t... | 12l-rob-lab | trunk/lab2/src/coreTask2.m | MATLAB | gpl3 | 1,542 |
#returts the pdf value for sample x over the set of given samples
#x - sample to classify (1 row of relevant attributes' values)
#samples - samples constituing a class (collection of rows of relevant attributes' values)
#width - width of the Parzen window to use
#
function p = parzen(x,samples,width)
p=0;
h=width/sqrt(... | 12l-rob-lab | trunk/lab2/src/parzen.m | M | gpl3 | 455 |
\documentclass{article}
\usepackage{polski}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage[usenames,dvipsnames]{color} % For colors and names
\title{Laboratorium Rozpoznawania Obrazów \\ ćwiczenie 2: klasyfikacja optymalna Bayesa} % Title
\author{Tomasz \textsc{Bawej}} % Author name
\definecolor{mygrey... | 12l-rob-lab | trunk/lab2/doc/report.tex | TeX | gpl3 | 16,540 |
addpath(pwd);
addpath([pwd, "/lib"]);
addpath([pwd, "/src"]);
addpath([pwd, "/../datasets"]);
[td tl ed el] = readSets();
[mu trmx] = prepTransform(td, 40);
td=pcaTransform(td,mu,trmx);
ed=pcaTransform(ed,mu,trmx);
| 12l-rob-lab | trunk/lab3-4/init.m | MATLAB | gpl3 | 215 |
function threshold = stagnationCriterion(iters, i, lowerBound = 7)
threshold=iters-iters*power(iters/(iters-max(iters*0.01,lowerBound))+power(e,i.*-1/(iters*0.1)),-1);
endfunction;
| 12l-rob-lab | trunk/lab3-4/src/stagnationCriterion.m | MATLAB | gpl3 | 185 |
function cmp = leaveOneOut(traindata, trainlabels, testdata, testlabels, bucketsNo)
cmp=[];
[trd buckets] = partitionData([trainlabels, traindata], bucketsNo);
procRows = 0;
for(attempt=1:bucketsNo)
#rows to form the test set
rowsNo = sum(buckets)(1,attempt);
firstRow = procRows... | 12l-rob-lab | trunk/lab3-4/src/leaveOneOut.m | MATLAB | gpl3 | 938 |
function answer = tellClass(sample, params, labels, exhaustiveMode=false)
classNo = size(unique(labels),1);
clsfrsNo = size(params,1);
allClsfrsNo = classNo+classNo*(classNo-1)/2;
sample = normalizeData(sample,params);
candidates = [];
for(i=1:size(unique(labels),1))
#either... | 12l-rob-lab | trunk/lab3-4/src/tellClass.m | MATLAB | gpl3 | 2,189 |
##assumes equal classes distribution
function [slice1 slice2] = sliceData(data, ratio)
uniqCl = unique(data(:,1));
skolko = floor(sum(data(:,1)==uniqCl(1,1))*ratio);
slice1=[];
slice2=[];
for(i=1:size(uniqCl,1))
subdata = data(data(:,1)==uniqCl(i),:);
order = randperm(size... | 12l-rob-lab | trunk/lab3-4/src/sliceData.m | MATLAB | gpl3 | 597 |
function h = hypothesis(data, params)
thetax = params*data';
h=1/(1+power(e,-thetax));
end;
| 12l-rob-lab | trunk/lab3-4/src/hypothesis.m | MATLAB | gpl3 | 100 |
function dcost = costDer(data, labels, params)
dcost = zeros(1,size(params,2));
order = randperm(size(labels,1));
for(i=1:size(order,2))
#cr for current row
cr = order(1,i);
dcost=dcost.+(( hypothesis(data(cr,:), params)-labels(cr,1) )* data(cr,:)); ... | 12l-rob-lab | trunk/lab3-4/src/costDer.m | MATLAB | gpl3 | 343 |
function stagnation(i, lowerBound=7)
x=linspace(1,i);
plot(x,stagnationCriterion(i,x,lowerBound));
endfunction;
| 12l-rob-lab | trunk/lab3-4/src/stagnation.m | MATLAB | gpl3 | 120 |
function ind = getParamsIndex(classes,i,j=0)
if(j==0)
ind=i;
else
ind=sum(classes:-1:classes-i+1)+j-i;
endif;
endfunction;
| 12l-rob-lab | trunk/lab3-4/src/getParamsIndex.m | MATLAB | gpl3 | 155 |
#expecting not normalized testdata
function [correctRatio errMatrix] = verify(testdata, testlabels, params, exhaustiveMode=false)
labelset=unique(testlabels);
errMatrix=zeros(size(labelset,1),size(labelset,1)+1);
correct=0;
for(i=1:size(testdata,1))
answer = tellClass(testdata(i,:),param... | 12l-rob-lab | trunk/lab3-4/src/verify.m | MATLAB | gpl3 | 544 |
function normalData = normalizeData(data, coeffs=[])
normalData=[ones(size(data,1),1),data];
end;
| 12l-rob-lab | trunk/lab3-4/src/normalizeData.m | MATLAB | gpl3 | 102 |
function [mockData mockLabels] = getMockData(data, labels, labelsCount=2, density=0.1)
uniqLabels = unique(labels);
mockLabels=[];
mockData=[];
order = randperm(size(uniqLabels,1));
uniqMockLabels=uniqLabels(1:labelsCount,1);
minCount = sum(labels==uniqLabels(1,1))*density;
for(i=2:siz... | 12l-rob-lab | trunk/lab3-4/src/getMockData.m | MATLAB | gpl3 | 792 |
function params = gradientDescent(data, labels, initParams, lr=3, vdata=[], allParams=[], paramsInd=-1, iterations=100, stagLimit=6, sensitivityThreshold=0.0001 )
iteration=0;
stagnant=-1;
params=initParams;
costDerivativeEst=sensitivityThreshold+1;
lRate = ones(1,size(data,2));
lRate ... | 12l-rob-lab | trunk/lab3-4/src/gradientDescent.m | MATLAB | gpl3 | 2,249 |
function [decParams vdata] = getDecPlane(data, labels, lRate, itersPerLevel=15)
classes = unique(labels);
dimensions = size(data,2);
classNo = size(classes,1);
decParams = [zeros(classNo,dimensions+1);zeros(classNo*(classNo-1)/2,dimensions+1)];
#slice it up
[data vdata] = sliceData([labe... | 12l-rob-lab | trunk/lab3-4/src/getDecPlane.m | MATLAB | gpl3 | 1,414 |
function [datasets buckets] = partitionData(data, subsets)
datasets=[];
classes = unique(data(:,1));
classNo = size(classes,1);
#rows: classes, cols: occurencies in given part
buckets = zeros(classNo,subsets);
order = randperm(size(data,1));
for(i=order)
cl=data(i,1);
... | 12l-rob-lab | trunk/lab3-4/src/partitionData.m | MATLAB | gpl3 | 1,224 |
\subsection{Eksperyment 2}
\begin{itemize}
\item Rozmiar danych treningowych: 80\% oryginalnego zbioru treningowego zredukowanego metodą PCA do 40 atrybutów.
\item Początkowa wartość współczynnika uczenia: 20;
\item Trening z wykorzystaniem zbioru walidującego, liczba iteracji: 20, min. próg kryterium stagnacji: 6 (war... | 12l-rob-lab | trunk/lab3-4/doc/eksperyment2.tex | TeX | gpl3 | 5,564 |
\subsection{Eksperyment 1}
\begin{itemize}
\item Rozmiar danych treningowych: 50\% oryginalnego zbioru treningowego zredukowanego metodą PCA do 40 atrybutów.
\item Początkowa wartość współczynnika uczenia: 20.
\item Trening z wykorzystaniem zbioru walidującego, liczba iteracji: 70, min. próg kryterium stagnacji: 6 (war... | 12l-rob-lab | trunk/lab3-4/doc/eksperyment1.tex | TeX | gpl3 | 5,438 |
\documentclass{article}
\usepackage{polski}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage[usenames,dvipsnames]{color} % For colors and names
\usepackage{amsmath}
\usepackage{graphicx}
\title{Laboratorium Rozpoznawania Obrazów \\ ćwiczenie 3-4: klasyfikatory liniowe w~rozpoznawaniu ręcznego pisma blokowe... | 12l-rob-lab | trunk/lab3-4/doc/report.tex | TeX | gpl3 | 12,800 |
function [confmx] = simpleMajority(labknn, tstl)
% simple absolut majority classifier
% labknn - matrix containing nearest neighbours labels
% each row contains NN labels for one test element
% tstl - test set labels (ground truth)
% confmx - confusion matrix of the classifier
treshold = floor(size(labknn, 2)/2)... | 12l-rob-lab | trunk/lab3-4/lib/simpleMajority.m | MATLAB | gpl3 | 545 |
function [errors] = compErrors(confmx)
% confmx - confusion matrix of the classifier
% errors - vector containing proper classifications, errors and reject decision coefficients (in %)
total = sum(sum(confmx));
errors(1) = trace(confmx) / total;
errors(2) = (total - trace(confmx) - sum(confmx(:,end))) / total;
... | 12l-rob-lab | trunk/lab3-4/lib/errors.m | MATLAB | gpl3 | 361 |
function [pcaSet] = pcaTransform(tvec, mu, trmx)
% tvec - matrix containing vectors to be transformed
% mu - mean value of the training set
% trmx - pca transformation matrix
% pcaSet - outpu set transforrmed to PCA space
% pcaSet = tvec - repmat(mu, size(tvec,1), 1);
pcaSet = zeros(size(tvec));
for i=1:size... | 12l-rob-lab | trunk/lab3-4/lib/pcaTransform.m | MATLAB | gpl3 | 393 |
function [labknn distknn] = labknn(trset, trlab, testset, k)
% labknn computes labels and distances to k nearest neighbours in the training set for all points
% in the test set
% trset - training set points
% trlab - labels of the samples in the training set
% testset - test set points
% k - number of neighbours... | 12l-rob-lab | trunk/lab3-4/lib/labknn.m | MATLAB | gpl3 | 776 |
function [tlab, tvec] = readmnist(datafn, labelfn)
% function reads mnist data and labels
fid = fopen(datafn, 'rb');
if fid==-1
error('Error opening data file');
end;
fseek(fid, 0, 'eof');
cnt = (ftell(fid) - 16)/784;
fseek(fid, 16, 'bof');
tvec=zeros(cnt, 784);
for i=1:cnt
im = fread(fid, 784, ... | 12l-rob-lab | trunk/lab3-4/lib/readmnist.m | MATLAB | gpl3 | 606 |
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
load("rec.dat");
load("tstl.dat");
stats=[rec, tstl];
scores=[];
iterations = 10;
startTime = cputime;
confidenceLevel=0.965;
for(trial=1:iterations)
[trainSet testSet] = splitSet(stats, 0.9);
credibilityMatrix = getPerformanceMatrix(trainSet);
testAnswers = maxCr... | 12l-rob-lab | trunk/initSplit.m | MATLAB | gpl3 | 1,015 |
[mtd mtl] = getMockData(td, tl, 10, 1.0);
[net hist] = train([300],0.2,mtd, mtl,0.03,15);
| 12l-rob-lab | trunk/lab5-6/launch.m | MATLAB | gpl3 | 90 |
#architectures={[],[30],[40],[60],[75],[100],[300],[500]};
#architectures={[30,40],[30,100],[75,60],[200,300],[30,40,60]};
architectures={[500]};
results=[];
times=[];
hists={}
nets={}
for(arch=1:size(architectures,2))
for(i=1:10)
t=cputime;
[net hist] = train(architectures{arch},0.2,td, tl,0.045... | 12l-rob-lab | trunk/lab5-6/batchTrain.m | MATLAB | gpl3 | 984 |
addpath(pwd);
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
addpath([pwd,"/../datasets"]);
[td, tl, ed, el] = readSets();
[mu trmx] = prepTransform(td, 40);
td=pcaTransform(td,mu,trmx);
ed=pcaTransform(ed,mu,trmx);
[td ed] = featureNormalize(td, ed);
mode="pca40";
| 12l-rob-lab | trunk/lab5-6/init_pca40.m | MATLAB | gpl3 | 266 |
addpath(pwd);
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
addpath([pwd,"/../datasets"]);
[td, tl, ed, el] = readSets();
[td ed mu span surplusCols] = featureNormalize(td, ed);
mode="raw_features";
| 12l-rob-lab | trunk/lab5-6/init_rawFeatures.m | MATLAB | gpl3 | 200 |
addpath(pwd);
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
addpath([pwd,"/../datasets"]);
[td, tl, ed, el] = readSets();
#[mu trmx] = prepTransform(td, 40);
[td ed] = featureNormalize(td, ed);
#td=pcaTransform(td,mu,trmx);
#ed=pcaTransform(ed,mu,trmx);
| 12l-rob-lab | trunk/lab5-6/init.m | MATLAB | gpl3 | 254 |
addpath(pwd);
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
addpath([pwd,"/../datasets"]);
[td, tl, ed, el] = readSets();
[mu trmx] = prepTransform(td, 49);
td=pcaTransform(td,mu,trmx);
ed=pcaTransform(ed,mu,trmx);
[td ed] = featureNormalize(td, ed);
mode="pca49";
| 12l-rob-lab | trunk/lab5-6/init_pca49.m | MATLAB | gpl3 | 266 |
function [guess confidence] = tellClass(sample, net, minConf=0)
input=askNet(net, sample);
[confidence guess] = max(input,[],2);
confidence=confidence./sum(input,2);
end;
| 12l-rob-lab | trunk/lab5-6/src/tellClass.m | MATLAB | gpl3 | 178 |
function [response responses]= askNet(net, input)
responses={};
#iterate over the layers
for(i=1:size(net,2))
#printf("layer %d \n",i);
responses{nextCell(responses, row=1)}=input;
input=[input, -ones(size(input,1),1)];
input=sigmoid(input*net{i});
end;
responses{nextCell(responses, row=1)}=input;
respons... | 12l-rob-lab | trunk/lab5-6/src/askNet.m | MATLAB | gpl3 | 334 |
function reduced = redDim(data, srcA, srcB, dstA, dstB)
targetCols = dstA*dstB;
if(srcA/dstA!=floor(srcA/dstA) || srcB/dstB!=floor(srcB/dstB))
printf("Nonconformant dimensions. No conversion.");
reduced=data;
return;
end;
mx = zeros(size(data,2),dstB*dstA);
for(targetCol=1:targetCols)
for(sourceRow=1:s... | 12l-rob-lab | trunk/lab5-6/src/redDim.m | MATLAB | gpl3 | 553 |
function [maxScoreNet history time] = train(
layers,
lRate,
data,
labels,
minTrnErr=0.004,
stagnationThreshold=20,
validationSet=0.075, #may either be a percentage of trainset or a separate set ending with label column
... | 12l-rob-lab | trunk/lab5-6/src/train.m | MATLAB | gpl3 | 3,514 |
#Returns ERROR ratio, rejected ratio and error matrix
function [errs rejected errmx] = evaluateWithConfidence (net, data, labels, conf)
if(max(labels)==9)
labels=labels.+1;
end;
classNo = size(unique(labels),1);
errmx=zeros(classNo, classNo+1);
[answers confidence] = tellClass(data, net);
answers(confidence<... | 12l-rob-lab | trunk/lab5-6/src/evaluateWithConfidence.m | MATLAB | gpl3 | 564 |
function [score errmx] = test(net, dat, lab)
t=cputime;
classNo = size(unique(lab),1);
errmx=zeros(classNo, classNo+1);
correct=0;
for(i=1:size(lab,1))
answer = tellClass(dat(i,:), net)-1;
if(answer==lab(i,1))
++correct;
end;
#fill in the error matrix
#printf("label: %d, answer: %d",lab(i,1),answer)... | 12l-rob-lab | trunk/lab5-6/src/test.m | MATLAB | gpl3 | 448 |
function ans = sigmoid(input)
ans=ones(size(input));
ans=ans./(1+exp(-input));
end;
| 12l-rob-lab | trunk/lab5-6/src/sigmoid.m | MATLAB | gpl3 | 86 |
function [traindigits trainlabels testdigits testlabels] = readAltSets()
load("testdigits");
load("traindigits");
trainlabels=traindigits(:, end);
traindigits(:,end)=[];
testlabels=testdigits(:,end);
testdigits(:,end)=[];
end;
| 12l-rob-lab | trunk/lab5-6/src/readAltSets.m | MATLAB | gpl3 | 237 |
function [mockData mockLabels leftoverData leftoverLabels] = getMockData(data, labels, labelsCount=2, density=0.1)
uniqLabels = unique(labels);
mockLabels=[];
mockData=[];
leftoverData=[];
leftoverLabels=[];
order = randperm(size(uniqLabels,1));
uniqMockLabels=uniqLabels(1:labelsCount,1... | 12l-rob-lab | trunk/lab5-6/src/getMockData.m | MATLAB | gpl3 | 1,074 |
function index = nextCell(array, row=1)
index=size(array,2)+1;
end;
| 12l-rob-lab | trunk/lab5-6/src/nextCell.m | MATLAB | gpl3 | 69 |
function [X_norm Y_norm mu span surplusCols] = featureNormalize(X, Y)
mu = mean(X);
span = max(X).-min(X);
X_norm = (X.-repmat(mu,size(X,1),1))./repmat(span,size(X,1),1);
Y_norm = (Y.-repmat(mu,size(Y,1),1))./repmat(span,size(Y,1),1);
surplusCols=span==0;
X_norm(:,surplusCols)=[];
Y_norm(:,surplusCols)=[];
end
| 12l-rob-lab | trunk/lab5-6/src/featureNormalize.m | MATLAB | gpl3 | 319 |
function [score errmx] = evaluate(net, data, labels)
if(max(labels)==9)
labels=labels.+1;
end;
classNo = size(unique(labels),1);
errmx=zeros(classNo, classNo+1);
answers = tellClass(data, net);
indices = [labels, answers];
for(i=1:size(indices,1))
errmx(indices(i,1),indices(i,2))+=1;
end
score=sum(ans... | 12l-rob-lab | trunk/lab5-6/src/evaluate.m | MATLAB | gpl3 | 355 |
addpath(pwd);
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
addpath([pwd,"/../datasets"]);
[td tl ed el] = readAltSets();
[td ed] = featureNormalize(td, ed);
mode = "alternative_dataset";
| 12l-rob-lab | trunk/lab5-6/init_alternative.dataset.m | Objective-C | gpl3 | 191 |
\subsection{Eksperyment 2}
Przedstawione poniżej wyniki zostały zebrane już~wyłącznie dla danych w~formacie PCA-40 oraz PCA-49. Najlepsze wyniki osiągnięto dla danych PCA-49 i jednej, 500-neuronowej warstwy ukrytej oraz dla PCA-40 oraz sieci o identycznej strukturze. Dla tych wariantów powtórzono proces, umożliwiając d... | 12l-rob-lab | trunk/lab5-6/doc/eksperyment2.tex | TeX | gpl3 | 3,636 |
\subsection{Eksperyment 1}
Poniższa tabela zawiera zestawienie wyników uzyskanych w pierwszym \textit{batchu}, w ramach którego algorytm uczenia sieci był parametryzowany stosunkowo niskim limitem stagnacji.
Trening przerwano w momencie, kiedy jasnym było, iż~użycie danych w~postaci obrazu 7x7 przekłada się na zauwa... | 12l-rob-lab | trunk/lab5-6/doc/eksperyment1.tex | TeX | gpl3 | 3,312 |
\documentclass{article}
\usepackage{polski}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage[usenames,dvipsnames]{color} % For colors and names
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tabularx}
\title{Laboratorium Rozpoznawania Obrazów \\ ćwiczenie 5-6: rozpoznawanie cyfr z wykorzystaniem si... | 12l-rob-lab | trunk/lab5-6/doc/report.tex | TeX | gpl3 | 16,779 |
addpath(pwd);
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
addpath([pwd,"/../datasets"]);
[td, tl, ed, el] = readSets();
td=redDim(td, 28, 28, 4, 4);
ed=redDim(ed, 28, 28, 4, 4);
[td ed] = featureNormalize(td, ed);
| 12l-rob-lab | trunk/lab5-6/init_shrunk4x4.m | MATLAB | gpl3 | 218 |
addpath(pwd);
addpath([pwd,"/lib"]);
addpath([pwd,"/src"]);
addpath([pwd,"/../datasets"]);
[td, tl, ed, el] = readSets();
td=redDim(td, 28, 28, 7, 7);
ed=redDim(ed, 28, 28, 7, 7);
[td ed] = featureNormalize(td, ed);
mode="shrunk7x7";
| 12l-rob-lab | trunk/lab5-6/init_shrunk7x7.m | MATLAB | gpl3 | 236 |
function [confmx] = simpleMajority(labknn, tstl)
% simple absolut majority classifier
% labknn - matrix containing nearest neighbours labels
% each row contains NN labels for one test element
% tstl - test set labels (ground truth)
% confmx - confusion matrix of the classifier
treshold = floor(size(labknn, 2)/2)... | 12l-rob-lab | trunk/lab5-6/lib/simpleMajority.m | MATLAB | gpl3 | 545 |
function [errors] = compErrors(confmx)
% confmx - confusion matrix of the classifier
% errors - vector containing proper classifications, errors and reject decision coefficients (in %)
total = sum(sum(confmx));
errors(1) = trace(confmx) / total;
errors(2) = (total - trace(confmx) - sum(confmx(:,end))) / total;
... | 12l-rob-lab | trunk/lab5-6/lib/errors.m | MATLAB | gpl3 | 361 |
function [pcaSet] = pcaTransform(tvec, mu, trmx)
% tvec - matrix containing vectors to be transformed
% mu - mean value of the training set
% trmx - pca transformation matrix
% pcaSet - outpu set transforrmed to PCA space
% pcaSet = tvec - repmat(mu, size(tvec,1), 1);
pcaSet = zeros(size(tvec));
for i=1:size... | 12l-rob-lab | trunk/lab5-6/lib/pcaTransform.m | MATLAB | gpl3 | 393 |
function [labknn distknn] = labknn(trset, trlab, testset, k)
% labknn computes labels and distances to k nearest neighbours in the training set for all points
% in the test set
% trset - training set points
% trlab - labels of the samples in the training set
% testset - test set points
% k - number of neighbours... | 12l-rob-lab | trunk/lab5-6/lib/labknn.m | MATLAB | gpl3 | 776 |
function [tlab, tvec] = readmnist(datafn, labelfn)
% function reads mnist data and labels
fid = fopen(datafn, 'rb');
if fid==-1
error('Error opening data file');
end;
fseek(fid, 0, 'eof');
cnt = (ftell(fid) - 16)/784;
fseek(fid, 16, 'bof');
tvec=zeros(cnt, 784);
for i=1:cnt
im = fread(fid, 784, ... | 12l-rob-lab | trunk/lab5-6/lib/readmnist.m | MATLAB | gpl3 | 606 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using DAO;
using DTO;
namespace LogisticSystem_WebService
{
/// <summary>
/// Summary description for LogisticSystemWS
/// </summary>
[WebService(Namespace =... | 09tmdtlast | trunk/LogisticSystem_WebService/LogisticSystemWS.asmx.cs | C# | asf20 | 7,659 |
<%@ WebService Language="C#" CodeBehind="LogisticSystemWS.asmx.cs" Class="LogisticSystem_WebService.LogisticSystemWS" %>
| 09tmdtlast | trunk/LogisticSystem_WebService/LogisticSystemWS.asmx | ASP.NET | asf20 | 125 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 09tmdtlast | trunk/LogisticSystem_WebService/Properties/AssemblyInfo.cs | C# | asf20 | 1,421 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class ChuyenVanChuyenDTO
{
private int _maChuyen;
public int MaChuyen
{
get { return _maChuyen; }
set { _maChuyen = value; }
}
... | 09tmdtlast | trunk/DTO/ChuyenVanChuyenDTO.cs | C# | asf20 | 1,163 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for XeDTO
/// </summary>
///
namespace DTO
{
public class XeDTO
{
private int m_MaXe;
public int MaXe
{
get { return m_MaXe; }
... | 09tmdtlast | trunk/DTO/XeDTO.cs | C# | asf20 | 2,337 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class KhoDTO
{
private int m_MaKho;
public int MaKho
{
get { return m_MaKho; }
set { m_MaKho = value; }
}
private string... | 09tmdtlast | trunk/DTO/KhoDTO.cs | C# | asf20 | 968 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class LoaiVanChuyenDTO
{
private int m_MaLoaiVC;
public int MaLoaiVC
{
get { return m_MaLoaiVC; }
set { m_MaLoaiVC = value; }
}
... | 09tmdtlast | trunk/DTO/LoaiVanChuyenDTO.cs | C# | asf20 | 660 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for TinhTrangXeDTO
/// </summary>
///
namespace DTO
{
public class TinhTrangXeDTO
{
private int _maXe;
public int MaXe
{
get { retur... | 09tmdtlast | trunk/DTO/TinhTrangXeDTO.cs | C# | asf20 | 1,039 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for TuyenVanChuyenDTO
/// </summary>
///
namespace DTO
{
public class TuyenVanChuyenDTO
{
private int m_MaTuyen;
public int MaTuyen
{
... | 09tmdtlast | trunk/DTO/TuyenVanChuyenDTO.cs | C# | asf20 | 1,438 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for DoanDuongDTO
/// </summary>
///
namespace DTO
{
public class DoanDuongDTO
{
private int _maDoanDuong;
public int MaDoanDuong
{
g... | 09tmdtlast | trunk/DTO/DoanDuongDTO.cs | C# | asf20 | 1,268 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class ChiNhanhDTO
{
private int _MaChiNhanh;
public int MaChiNhanh
{
get { return _MaChiNhanh; }
set { _MaChiNhanh = value; }
}
... | 09tmdtlast | trunk/DTO/ChiNhanhDTO.cs | C# | asf20 | 846 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class NhanVienDTO
{
private int m_MaNhanVien;
public int MaNhanVien
{
get { return m_MaNhanVien; }
set { m_MaNhanVien = value; }
... | 09tmdtlast | trunk/DTO/NhanVienDTO.cs | C# | asf20 | 1,419 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class LoaiNhanVienDTO
{
private int m_MaLoaiNV;
public int MaLoaiNV
{
get { return m_MaLoaiNV; }
set { m_MaLoaiNV = value; }
}
... | 09tmdtlast | trunk/DTO/LoaiNhanVienDTO.cs | C# | asf20 | 508 |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTi... | 09tmdtlast | trunk/DTO/Properties/AssemblyInfo.cs | C# | asf20 | 1,418 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for DiaDiemDTO
/// </summary>
///
namespace DTO
{
public class DiaDiemDTO
{
private int _maDiaDiem;
public int MaDiaDiem
{
get { ret... | 09tmdtlast | trunk/DTO/DiaDiemDTO.cs | C# | asf20 | 1,227 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class VanChuyenDTO
{
private int m_MaDatVanChuyen;
public int MaDatVanChuyen
{
get { return m_MaDatVanChuyen; }
set { m_MaDatVanChuyen = v... | 09tmdtlast | trunk/DTO/VanChuyenDTO.cs | C# | asf20 | 688 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class KhachHangDTO
{
private int m_MaKhachHang;
public int MaKhachHang
{
get { return m_MaKhachHang; }
set { m_MaKhachHang = value; }
... | 09tmdtlast | trunk/DTO/KhachHangDTO.cs | C# | asf20 | 1,745 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for LichVanChuyenDTO
/// </summary>
///
namespace DTO
{
public class LichVanChuyenDTO
{
private int _maLich;
public int MaLich
{
g... | 09tmdtlast | trunk/DTO/LichVanChuyenDTO.cs | C# | asf20 | 1,239 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for LoTrinhTuyenDTO
/// </summary>
///
namespace DTO
{
public class LoTrinhTuyenDTO
{
private int _maTuyen;
public int MaTuyen
{
get... | 09tmdtlast | trunk/DTO/LoTrinhTuyenDTO.cs | C# | asf20 | 840 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class MonHangDTO
{
private int m_MaMonHang;
public int MaMonHang
{
get { return m_MaMonHang; }
set { m_MaMonHang = value; }
}
... | 09tmdtlast | trunk/DTO/MonHangDTO.cs | C# | asf20 | 2,156 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTO
{
public class DatVanChuyenDTO
{
private int m_MaDatVanChuyen;
public int MaDatVanChuyen
{
get { return m_MaDatVanChuyen; }
set { m_MaDatVanChuyen ... | 09tmdtlast | trunk/DTO/DatVanChuyenDTO.cs | C# | asf20 | 1,408 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
/// <summary>
/// Summary description for TinhTrangDTO
/// </summary>
///
namespace DTO
{
public class TinhTrangDTO
{
private int _maTinhTrang;
public int MaTinhTrang
{
g... | 09tmdtlast | trunk/DTO/TinhTrangDTO.cs | C# | asf20 | 911 |
function GetListChiNhanh() {
strData = "cmd=GetListChiNhanh";
//alert(strData);
$.ajax({
url: 'ajaxActions.aspx',
type: 'GET',
data: strData,
timeout: 4000,
error: function (msg) {
alert('Server quá tải - GetListChiNhanh');
GetList... | 09tmdtlast | trunk/LogisticSystem_Client/Scripts/Order.js | JavaScript | asf20 | 2,864 |
/*
* Autocomplete - jQuery plugin 1.0.2
*
* Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.... | 09tmdtlast | trunk/LogisticSystem_Client/Scripts/jquery.autocomplete.js | JavaScript | asf20 | 19,836 |
function formatCurrency(num){
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
num = Math.floor(num/100).toString();
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num ... | 09tmdtlast | trunk/LogisticSystem_Client/Scripts/orderFood.js | JavaScript | asf20 | 16,310 |
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera... | 09tmdtlast | trunk/LogisticSystem_Client/Scripts/AC_RunActiveContent.js | JavaScript | asf20 | 8,321 |
// JavaScript Document
function iShow(divShow, divHide, iType,msg){
// Định nghĩa từng loại show ở đây
// 1. FadeIn 2.Show 3...
switch(iType){
case 1:{
$('#' + divHide).slideUp("fast");
//$('#' + divShow).html(msg);
$('#' + divShow).slideDown("fast");
... | 09tmdtlast | trunk/LogisticSystem_Client/Scripts/jLogin.js | JavaScript | asf20 | 4,063 |