⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo.m

📁 一个包含丰富内容的流形学习算法工具包
💻 M
📖 第 1 页 / 共 2 页
字号:
    case 2 % supervised        disp('Running in Supervised Mode');        Y1=Y;        handles.Y=Y1;        handles.generate=1;    case 1 % unsupervised        method='clustering';        Y1=zeros(length(Y),1);        handles.Y=Y1;        handles.generate=1;    case 3 % semi-supervised       gen=handles.generate;        if gen==1                    ipos=find(Y>0);        ineg=find(Y<0);        lab=handles.lab;        rpos=randperm(length(ipos)); rneg=randperm(length(ineg));        Y1=zeros(length(Y),1);        Y1(ipos(rpos(1:lab)))=1;        Y1(ineg(rneg(1:lab)))=-1;        handles.generate=0;        handles.Y=Y1;     else        handles.generate=0;    end        endclassifier=ml_train(X,handles.Y,options,method);xmin=min(X(:,1)); ymin=min(X(:,2)); rmin=min(xmin,ymin)-0.2;xmax=max(X(:,1)); ymax=max(X(:,2)); rmax=max(xmax,ymax)+0.2;steps=(rmax-rmin)/100;xrange=rmin:steps:rmax;yrange=rmin:steps:rmax;plotclassifiers(classifier,xrange,yrange); title(method,'Color','w'); hold on;h=gca; set(h,'Xcolor','w'); set(h,'Ycolor','w')unlab=find(handles.Y==0); plot2D(X(unlab,:),handles.Y(unlab),10); hold on;lab=find(handles.Y);plot2D(X(lab,:),handles.Y(lab),17);hold off; guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function select_dataset_CreateFcn(hObject, eventdata, handles)% hObject    handle to select_dataset (see GCBO)z% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in select_dataset.function select_dataset_Callback(hObject, eventdata, handles)% hObject    handle to select_dataset (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns select_dataset contents as cell array%        contents{get(hObject,'Value')} returns selected item from select_datasetcontents = get(hObject,'String');dataset=contents{get(hObject,'Value')};handles.data=load([dataset '.mat']);guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function numlabeled_CreateFcn(hObject, eventdata, handles)% hObject    handle to numlabeled (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction numlabeled_Callback(hObject, eventdata, handles)% hObject    handle to numlabeled (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of numlabeled as text%        str2double(get(hObject,'String')) returns contents of numlabeled as a doublehandles.lab=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function rbfwidth_CreateFcn(hObject, eventdata, handles)% hObject    handle to rbfwidth (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction rbfwidth_Callback(hObject, eventdata, handles)% hObject    handle to rbfwidth (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of rbfwidth as text%        str2double(get(hObject,'String')) returns contents of rbfwidth as a doublehandles.kernelparam=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes on button press in radiobutton1.function radiobutton1_Callback(hObject, eventdata, handles)% hObject    handle to radiobutton1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton1off = [handles.radiobutton2,handles.radiobutton3];mutual_exclude(off)handles.mode=1; % fully supervisedguidata(hObject,handles);% --- Executes on button press in radiobutton2.function radiobutton2_Callback(hObject, eventdata, handles)% hObject    handle to radiobutton2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton2off = [handles.radiobutton1,handles.radiobutton3];mutual_exclude(off)handles.mode=2; % unsupervisedguidata(hObject,handles);% --- Executes on button press in radiobutton3.function radiobutton3_Callback(hObject, eventdata, handles)% hObject    handle to radiobutton3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of radiobutton3off = [handles.radiobutton1,handles.radiobutton2];mutual_exclude(off)handles.mode=3; % semisupervisedguidata(hObject,handles);function mutual_exclude(off)set(off,'Value',0)% --- Executes on button press in generate.function generate_Callback(hObject, eventdata, handles)% hObject    handle to generate (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)handles.generate=1;guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function gamma_A_value_CreateFcn(hObject, eventdata, handles)% hObject    handle to gamma_A_value (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction gamma_A_value_Callback(hObject, eventdata, handles)% hObject    handle to gamma_A_value (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of gamma_A_value as text%        str2double(get(hObject,'String')) returns contents of gamma_A_value as a double% --- Executes during object creation, after setting all properties.function gamma_I_value_CreateFcn(hObject, eventdata, handles)% hObject    handle to gamma_I_value (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction gamma_I_value_Callback(hObject, eventdata, handles)% hObject    handle to gamma_I_value (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of gamma_I_value as text%        str2double(get(hObject,'String')) returns contents of gamma_I_value as a double

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -