Map&Reduce Verfahren

Diskutiere Map&Reduce Verfahren im Developer Network Forum im Bereich Hardware & Software Forum; Hallo liebes Forum :). Ein Freund hatte die bitte ihm beim Map and Reduce verfahren zu helfen, zumindest mal um die Schleifen "verschwinden"...
  • Map&Reduce Verfahren Beitrag #1
R

Relaxx

Mitglied
Dabei seit
19.10.2009
Beiträge
12
Reaktionspunkte
0
Hallo liebes Forum :).

Ein Freund hatte die bitte ihm beim Map and Reduce verfahren zu helfen, zumindest mal um die Schleifen "verschwinden" zu lassen. Kann mir da jemand mal schnell auf die Sprünge helfen!? Hatten dies von einiger Zeit in der Schule vorgenommen; aber Netzwerktechnik hat eben nicht viel mit Anwendungsentwicklung zu tun :D. Kann mir jemand mal das in MP aufzeigen?

Grüße
Code:
/*
 * 
 * "Information Systems"
 *
 * CloudClust
 */

package de.unidue.inf.is.cloudclust.server.model.labeling;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author XYZ
 *
 */
public class ClusterLabel {

    private ArrayList<Double> tf = new ArrayList<Double>();
//    private ArrayList<Double> idf = new ArrayList<Double>();
    private ArrayList<String> terms = new ArrayList<String>();
    private ArrayList<String> clusterId = new ArrayList<String>();
//    private ArrayList<String> dokVecId = new ArrayList<String>();

    private ArrayList<Double> tfmean = new ArrayList<Double>();
    private ArrayList<Double> tfmeanclone = new ArrayList<Double>();
    private ArrayList<String> termssort = new ArrayList<String>();
    private ArrayList<String> firstterms = new ArrayList<String>();

    public List<String> getLabel() {
        //Method getDocVecCollecion
        //write ArrayList 

        double h = 0;
        int anzahl = 0;
        for (String term : terms) {
            int pos = terms.indexOf(term);
            for (String dok : clusterId) {
                //created relation between tf and document
                h = h + tf.get(pos);
                anzahl++;
            }
            tfmean.add(pos, (h / anzahl));
        }

        //start sorting here
        for (Double wert : tfmean) {
            tfmeanclone.add(wert);
        }
        double max = 0;
//        int index;
        while (tfmeanclone.size() != 0) {
            for (double wert : tfmeanclone) {
                if (wert > max) {
                    max = wert;
                }
            }
            //check if same index
            termssort.add(terms.get(tfmeanclone.indexOf(max)));
            tfmeanclone.remove(tfmeanclone.indexOf(max));
        }
        return termssort;
    }



public List<String> getFirst(){
    int x=0;
    while (x <=20){
    
    firstterms.add(termssort.get(x));
    x++;
    }
     return firstterms;
  }
}
 
Thema:

Map&Reduce Verfahren

ANGEBOTE & SPONSOREN

https://www.mofapower.de/

Statistik des Forums

Themen
213.179
Beiträge
1.579.172
Mitglieder
55.878
Neuestes Mitglied
Satan666
Oben