how to rank the nearest neighbor in the results from similar to data?

inceptorfullinceptorfull Member Posts: 44 Contributor II
edited November 2018 in Help
Hi all, I am conducting credit scoring research and want to do the following steps:

I make Neural network predict the unassigned label in the customer group , then use such assigned label to be input for K-Nearest neighbour so I can find the closest similar company for the predicted company , attached the process , using similar to data and data similarity, got me the distance between each company,

Is that right? if so how to just put the top (K) neigbors in the results, not all the matrix?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="7.0.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process">
    <parameter key="logverbosity" value="init"/>
    <parameter key="random_seed" value="2001"/>
    <parameter key="send_mail" value="never"/>
    <parameter key="notification_email" value=""/>
    <parameter key="process_duration_for_mail" value="30"/>
    <parameter key="encoding" value="SYSTEM"/>
    <process expanded="true">
      <operator activated="true" class="retrieve" compatibility="7.0.000" expanded="true" height="68" name="Missing Data label" width="90" x="45" y="289">
        <parameter key="repository_entry" value="//Local Repository/PHd/Testing Data for 2014"/>
      </operator>
      <operator activated="true" class="retrieve" compatibility="7.0.000" expanded="true" height="68" name="Training Data Table" width="90" x="45" y="85">
        <parameter key="repository_entry" value="//Local Repository/PHd/Training Data for 2014"/>
      </operator>
      <operator activated="true" class="split_validation" compatibility="7.0.000" expanded="true" height="124" name="Validation" width="90" x="179" y="34">
        <parameter key="create_complete_model" value="false"/>
        <parameter key="split" value="relative"/>
        <parameter key="split_ratio" value="0.7"/>
        <parameter key="training_set_size" value="100"/>
        <parameter key="test_set_size" value="-1"/>
        <parameter key="sampling_type" value="shuffled sampling"/>
        <parameter key="use_local_random_seed" value="false"/>
        <parameter key="local_random_seed" value="1992"/>
        <process expanded="true">
          <operator activated="true" class="neural_net" compatibility="7.0.000" expanded="true" height="82" name="Neural Net" width="90" x="110" y="34">
            <list key="hidden_layers"/>
            <parameter key="training_cycles" value="500"/>
            <parameter key="learning_rate" value="0.3"/>
            <parameter key="momentum" value="0.2"/>
            <parameter key="decay" value="false"/>
            <parameter key="shuffle" value="true"/>
            <parameter key="normalize" value="true"/>
            <parameter key="error_epsilon" value="1.0E-5"/>
            <parameter key="use_local_random_seed" value="false"/>
            <parameter key="local_random_seed" value="1992"/>
          </operator>
          <connect from_port="training" to_op="Neural Net" to_port="training set"/>
          <connect from_op="Neural Net" from_port="model" to_port="model"/>
          <portSpacing port="source_training" spacing="0"/>
          <portSpacing port="sink_model" spacing="0"/>
          <portSpacing port="sink_through 1" spacing="0"/>
        </process>
        <process expanded="true">
          <operator activated="true" class="apply_model" compatibility="5.0.000" expanded="true" height="82" name="Apply Model (2)" width="90" x="45" y="30">
            <list key="application_parameters"/>
            <parameter key="create_view" value="false"/>
          </operator>
          <operator activated="true" class="performance" compatibility="5.0.000" expanded="true" height="82" name="Performance" width="90" x="179" y="30">
            <parameter key="use_example_weights" value="true"/>
          </operator>
          <connect from_port="model" to_op="Apply Model (2)" to_port="model"/>
          <connect from_port="test set" to_op="Apply Model (2)" to_port="unlabelled data"/>
          <connect from_op="Apply Model (2)" from_port="labelled data" to_op="Performance" to_port="labelled data"/>
          <connect from_op="Performance" from_port="performance" to_port="averagable 1"/>
          <portSpacing port="source_model" spacing="0"/>
          <portSpacing port="source_test set" spacing="0"/>
          <portSpacing port="source_through 1" spacing="0"/>
          <portSpacing port="sink_averagable 1" spacing="0"/>
          <portSpacing port="sink_averagable 2" spacing="0"/>
        </process>
      </operator>
      <operator activated="true" class="k_nn" compatibility="7.0.000" expanded="true" height="82" name="k-NN" width="90" x="380" y="85">
        <parameter key="k" value="6"/>
        <parameter key="weighted_vote" value="false"/>
        <parameter key="measure_types" value="NumericalMeasures"/>
        <parameter key="mixed_measure" value="MixedEuclideanDistance"/>
        <parameter key="nominal_measure" value="NominalDistance"/>
        <parameter key="numerical_measure" value="EuclideanDistance"/>
        <parameter key="divergence" value="GeneralizedIDivergence"/>
        <parameter key="kernel_type" value="radial"/>
        <parameter key="kernel_gamma" value="1.0"/>
        <parameter key="kernel_sigma1" value="1.0"/>
        <parameter key="kernel_sigma2" value="0.0"/>
        <parameter key="kernel_sigma3" value="2.0"/>
        <parameter key="kernel_degree" value="3.0"/>
        <parameter key="kernel_shift" value="1.0"/>
        <parameter key="kernel_a" value="1.0"/>
        <parameter key="kernel_b" value="0.0"/>
      </operator>
      <operator activated="true" class="apply_model" compatibility="7.0.000" expanded="true" height="82" name="Apply Model" width="90" x="179" y="289">
        <list key="application_parameters"/>
        <parameter key="create_view" value="true"/>
      </operator>
      <operator activated="true" breakpoints="after" class="data_to_similarity" compatibility="7.0.000" expanded="true" height="82" name="Data to Similarity" width="90" x="447" y="289">
        <parameter key="measure_types" value="NumericalMeasures"/>
        <parameter key="mixed_measure" value="MixedEuclideanDistance"/>
        <parameter key="nominal_measure" value="NominalDistance"/>
        <parameter key="numerical_measure" value="EuclideanDistance"/>
        <parameter key="divergence" value="LogisticLoss"/>
        <parameter key="kernel_type" value="radial"/>
        <parameter key="kernel_gamma" value="1.0"/>
        <parameter key="kernel_sigma1" value="1.0"/>
        <parameter key="kernel_sigma2" value="0.0"/>
        <parameter key="kernel_sigma3" value="2.0"/>
        <parameter key="kernel_degree" value="3.0"/>
        <parameter key="kernel_shift" value="1.0"/>
        <parameter key="kernel_a" value="1.0"/>
        <parameter key="kernel_b" value="0.0"/>
      </operator>
      <operator activated="true" class="similarity_to_data" compatibility="7.0.000" expanded="true" height="82" name="Similarity to Data" width="90" x="581" y="85">
        <parameter key="table_type" value="matrix"/>
      </operator>
      <connect from_op="Missing Data label" from_port="output" to_op="Apply Model" to_port="unlabelled data"/>
      <connect from_op="Training Data Table" from_port="output" to_op="Validation" to_port="training"/>
      <connect from_op="Validation" from_port="training" to_op="k-NN" to_port="training set"/>
      <connect from_op="k-NN" from_port="model" to_op="Apply Model" to_port="model"/>
      <connect from_op="Apply Model" from_port="labelled data" to_op="Data to Similarity" to_port="example set"/>
      <connect from_op="Data to Similarity" from_port="similarity" to_op="Similarity to Data" to_port="similarity"/>
      <connect from_op="Data to Similarity" from_port="example set" to_op="Similarity to Data" to_port="exampleSet"/>
      <connect from_op="Similarity to Data" from_port="exampleSet" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="0"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>

Sign In or Register to comment.