title: unmixing in earth engine and generate classification map
body: <p>hello I apply unmixing on sentinel image based on the spectral signatures I provided</p>
  <p>here is the code:</p>
  <pre><code>var SentinelColl = ee.ImageCollection(&quot;COPERNICUS/S2_SR&quot;)
      .filterBounds(geometry)
      .filterMetadata('CLOUDY_PIXEL_PERCENTAGE', 'less_than', 5)
      .filterMetadata('SNOW_ICE_PERCENTAGE','less_than',5)
     .filterDate('2020-01-01', '2022-01-01')
      .sort('system:index',false)
      .select('B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8','B8A','B11','B12')
      .median()
  
  
  var classNames = Urban.merge(Water).merge(Forest).merge(AgricultureWet).merge(AgricultureDry).merge(MinesNew)
  //.merge(shadow).merge(barren)//.merge(roadL1).merge(roadL2);
  var bands = Sentinel.bandNames();
  
  var training = Sentinel.sampleRegions({
    collection: classNames,
    properties: ['landcover'],
    scale: 10
  });
  
      var fractions = Sentinel.clip(geometry).unmix([mineSP, agrWSP,agrDSP,waterSP,forsSP,urbSP],true,true);
  </code></pre>
  <p>but how can I generate final classification map so that each pixel assigned and coded as the endmember with the max fraction?<br />
  like in ENVI: max rule classifier</p>
  <p>I want to generate a map which each pixel assigned to one class based on the aboundance /fraction values of them</p>
  <p>finally I will calculate the number of pixels that assigned to each class</p>