• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.VectorSpaceClusterer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nltk.cluster.util.VectorSpaceClusterer的典型用法代码示例。如果您正苦于以下问题:Python VectorSpaceClusterer类的具体用法?Python VectorSpaceClusterer怎么用?Python VectorSpaceClusterer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VectorSpaceClusterer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, initial_means, priors=None, covariance_matrices=None,
                       conv_threshold=1e-6, bias=0.1, normalise=False,
                       svd_dimensions=None):
        """
        Creates an EM clusterer with the given starting parameters,
        convergence threshold and vector mangling parameters.

        :param  initial_means: the means of the gaussian cluster centers
        :type   initial_means: [seq of] numpy array or seq of SparseArray
        :param  priors: the prior probability for each cluster
        :type   priors: numpy array or seq of float
        :param  covariance_matrices: the covariance matrix for each cluster
        :type   covariance_matrices: [seq of] numpy array
        :param  conv_threshold: maximum change in likelihood before deemed
                    convergent
        :type   conv_threshold: int or float
        :param  bias: variance bias used to ensure non-singular covariance
                      matrices
        :type   bias: float
        :param  normalise:  should vectors be normalised to length 1
        :type   normalise:  boolean
        :param  svd_dimensions: number of dimensions to use in reducing vector
                               dimensionsionality with SVD
        :type   svd_dimensions: int
        """
        VectorSpaceClusterer.__init__(self, normalise, svd_dimensions)
        self._means = numpy.array(initial_means, numpy.float64)
        self._num_clusters = len(initial_means)
        self._conv_threshold = conv_threshold
        self._covariance_matrices = covariance_matrices
        self._priors = priors
        self._bias = bias
开发者ID:52nlp,项目名称:Text-Summarization,代码行数:32,代码来源:em.py


示例2: __init__

 def __init__(self, num_means, distance, repeats=1,
                    conv_test=1e-6, initial_means=None,
                    normalise=False, svd_dimensions=None,
                    rng=None):
     """
     :param  num_means:  the number of means to use (may use fewer)
     :type   num_means:  int
     :param  distance:   measure of distance between two vectors
     :type   distance:   function taking two vectors and returing a float
     :param  repeats:    number of randomised clustering trials to use
     :type   repeats:    int
     :param  conv_test:  maximum variation in mean differences before
                         deemed convergent
     :type   conv_test:  number
     :param  initial_means: set of k initial means
     :type   initial_means: sequence of vectors
     :param  normalise:  should vectors be normalised to length 1
     :type   normalise:  boolean
     :param svd_dimensions: number of dimensions to use in reducing vector
                            dimensionsionality with SVD
     :type svd_dimensions: int 
     :param  rng:        random number generator (or None)
     :type   rng:        Random
     """
     VectorSpaceClusterer.__init__(self, normalise, svd_dimensions)
     self._num_means = num_means
     self._distance = distance
     self._max_difference = conv_test
     assert not initial_means or len(initial_means) == num_means
     self._means = initial_means
     assert repeats >= 1
     assert not (initial_means and repeats > 1)
     self._repeats = repeats
     if rng: self._rng = rng
     else:   self._rng = random.Random()
开发者ID:timClicks,项目名称:nltk,代码行数:35,代码来源:kmeans.py


示例3: cluster

 def cluster(self, vectors, assign_clusters=False, trace=False):
     # stores the merge order
     self._dendrogram = Dendrogram(
         [numpy.array(vector, numpy.float64) for vector in vectors])
     return VectorSpaceClusterer.cluster(self, vectors, assign_clusters, trace)
开发者ID:DrDub,项目名称:nltk,代码行数:5,代码来源:gaac.py


示例4: __init__

 def __init__(self, num_clusters=1, normalise=True, svd_dimensions=None):
     VectorSpaceClusterer.__init__(self, normalise, svd_dimensions)
     self._num_clusters = num_clusters
     self._dendrogram = None
     self._groups_values = None
开发者ID:DrDub,项目名称:nltk,代码行数:5,代码来源:gaac.py



注:本文中的nltk.cluster.util.VectorSpaceClusterer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python collocations.BigramCollocationFinder类代码示例发布时间:2022-05-27
下一篇:
Python util.names_demo函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap