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

📄 clusterer.java

📁 这是一个matlab的java实现。里面有许多内容。请大家慢慢捉摸。
💻 JAVA
字号:
/* Copyright (C) 2002 Dept. of Computer Science, Univ. of Massachusetts, AmherstThis file is part of "MALLET" (MAchine Learning for LanguagE Toolkit).http://www.cs.umass.edu/~mccallum/malletThis program toolkit free software; you can redistribute it and/ormodify it under the terms of the GNU General Public License aspublished by the Free Software Foundation; either version 2 of theLicense, or (at your option) any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  For moredetails see the GNU General Public License and the file README-LEGAL.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA02111-1307, USA. *//**	 @author Ben Wellner*/package edu.umass.cs.mallet.projects.seg_plus_coref.clustering;import salvo.jesus.graph.*;import edu.umass.cs.mallet.projects.seg_plus_coref.graphs.*;import edu.umass.cs.mallet.projects.seg_plus_coref.clustering.*;import java.util.*;public class Clusterer {    MappedGraph mGraph;    WeightedGraph graph;    public Clusterer (MappedGraph graph)    {	mGraph = graph;	this.graph = graph.getGraph();    }    public Clusterer ()    {    }    public void setGraph (MappedGraph graph)    {	this.mGraph = graph;	this.graph = graph.getGraph();    }    public MappedGraph getMappedGraph ()    {	return mGraph;    }    public WeightedGraph getGraph ()    {	return graph;    }    /*    public Clustering getClustering (MappedGraph graph)    {	setGraph(graph);	return getClustering();	}*/    public Clustering getClusteringGreedily ()     {	MinimizeDisagreementsClustering minClustering = null;	// clustering algorithm here	if (mGraph != null) {	    minClustering = new MinimizeDisagreementsClustering(mGraph,(double)1/44);	}	else {	    return null;	}	Clustering cl = minClustering.getClusteringGreedily();	System.out.println("Number of clusters: " + cl.size());	return (Clustering)new GraphClustering (graph, cl);    }    public Clustering getClustering (Clustering prevClustering)    {	MinimizeDisagreementsClustering minClustering = null;	// clustering algorithm here	if (mGraph != null) {	    minClustering = new MinimizeDisagreementsClustering(mGraph,(double)1/44);	}	else {	    return null;	}	Clustering cl = null;	if (prevClustering != null)	    cl = minClustering.getClustering(prevClustering.getSelectVertices());	else 	    cl = minClustering.getClustering(null);	return (Clustering)new GraphClustering (graph, cl);    }    public Clustering getClustering ()  // might need some parameters here ...    {	return getClustering(null);    }}

⌨️ 快捷键说明

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