clustering/scripts/cluster_docs.py
def create_document_clusters(
        name, group_id, n_clusters,
        CLUSTER_CLASS=KMeansDocs, doc2vec_group_id=None
        ):
    """
    Create document clusters(ClusteringModel object) based on input params
    @name: name of the model
    @group_id: group_id of the model
    @CLUSTER_CLASS: class on which the clustring(KMeans) is based
    @doc2vec_group_id: relevant if clusterclass is KMeansDoc2Vec, get doc2vec
        model and load vectors from it
    """
    # first check if group_id already exists or not
    try:
        ClusteringModel.objects.get(group_id=group_id)
        raise Exception("Cluster model with group_id {} already exists".format(
            group_id))
    except ClusteringModel.DoesNotExist:
        pass
        # create new clustering model
    create_new_clusters(
        name, group_id, n_clusters, CLUSTER_CLASS, doc2vec_group_id
    )

    Create document clusters(ClusteringModel object) based on input params
    @name: name of the model
    @group_id: group_id of the model
    @CLUSTER_CLASS: class on which the clustring(KMeans) is based
    @doc2vec_group_id: relevant if clusterclass is KMeansDoc2Vec, get doc2vec
        model and load vectors from it
    
Create document clusters(ClusteringModel object) based on input params
Create document clusters ( ClusteringModel object ) based on input params
def create_document_clusters(
        name, group_id, n_clusters,
        CLUSTER_CLASS=KMeansDocs, doc2vec_group_id=None
        ):
    try:
        ClusteringModel.objects.get(group_id=group_id)
        raise Exception("Cluster model with group_id {} already exists".format(
            group_id))
    except ClusteringModel.DoesNotExist:
        pass
    create_new_clusters(
        name, group_id, n_clusters, CLUSTER_CLASS, doc2vec_group_id
    )
def create_document_clusters ( name , group_id , n_clusters , CLUSTER_CLASS = KMeansDocs , doc2vec_group_id = None ) : try : ClusteringModel . objects . get ( group_id = group_id ) raise Exception ( "Cluster model with group_id {} already exists" . format ( group_id ) ) except ClusteringModel . DoesNotExist : pass create_new_clusters ( name , group_id , n_clusters , CLUSTER_CLASS , doc2vec_group_id )
Create document clusters(ClusteringModel object) based on input params
Create document clusters ( ClusteringModel object ) based on input params
"""
    Create document clusters(ClusteringModel object) based on input params
    @name: name of the model
    @group_id: group_id of the model
    @CLUSTER_CLASS: class on which the clustring(KMeans) is based
    @doc2vec_group_id: relevant if clusterclass is KMeansDoc2Vec, get doc2vec
        model and load vectors from it
    """ # first check if group_id already exists or not # create new clustering model
name
group_id
n_clusters
CLUSTER_CLASS
doc2vec_group_id
name
name of the model
name of the model
group_id
group_id of the model
group_id of the model
CLUSTER_CLASS
class on which the clustring(KMeans) is based
class on which the clustring ( KMeans ) is based
doc2vec_group_id
relevant if clusterclass is KMeansDoc2Vec, get doc2vec
model and load vectors from it
relevant if clusterclass is KMeansDoc2Vec get doc2vec model and load vectors from it