Beispiel #1
0
def create_kmedoid_clustering(doc2vec_model_file_path, tsne_model_file_path, start_medoids, new_hostnames=None):
    """helper function to create K-Medoid clustering plot
    :param doc2vec_model_file_path: file path of doc2vec model
    :param tsne_model_file_path: file path of tsne model
    other parameters are explained in dbscan_clustering function

    """

    doc2vec_model = doc2vec.load_existing_model(doc2vec_model_file_path=doc2vec_model_file_path)
    tsne_model = tsne.load_tsne_model(tsne_model_file_path=tsne_model_file_path)
    kmedoid_clustering(doc2vec_model, tsne_model, start_medoids, new_hostnames=new_hostnames)
Beispiel #2
0
def create_affinity_propagation_cluster(doc2vec_model_file_path, tsne_model_file_path, model_language,
                                        save_to_directory, new_hostnames=None):
    """helper function to create affinity propagation clustering plot
    :param doc2vec_model_file_path: file path of doc2vec model
    :param tsne_model_file_path: file path of tsne model
    other parameters are explained in affinity_propagation_cluster function

    """

    doc2vec_model = doc2vec.load_existing_model(doc2vec_model_file_path=doc2vec_model_file_path)
    tsne_model = tsne.load_tsne_model(tsne_model_file_path=tsne_model_file_path)
    affinity_propagation_cluster(doc2vec_model, tsne_model, model_language, new_hostnames, save_to_directory)
Beispiel #3
0
def main():
    # example usage for create K-Medoid Clustering
    doc2vec_model = doc2vec.load_existing_model(
        model_file_name='doc2vec_single_language_full_model_german_18_Feb_2018_22_31_27')

    tsne_model = tsne.load_tsne_model(
        model_file_name='t_sne_single_language_full_model_doc2vec_model_german_20_Feb_2018_08_56_12.npy')

    kmedoid_clustering(doc2vec_model,
                       tsne_model,
                       start_medoids=[0, 5, 10, 15, 20, 25, 30, 35])

    '''
Beispiel #4
0
def main():

    # example usage for creating an affinity propagation cluster
    doc2vec_model = doc2vec.load_existing_model(
        model_file_name='doc2vec_single_language_full_model_german_18_Feb_2018_22_31_27')

    tsne_model = tsne.load_tsne_model(
        model_file_name='t_sne_single_language_full_model_doc2vec_model_german_20_Feb_2018_08_56_12.npy')

    affinity_propagation_cluster(doc2vec_model=doc2vec_model,
                                 tsne_model=tsne_model,
                                 model_language='single_language_full_german')

    '''
def main():
    # example usage for create Agglomerative Clustering
    doc2vec_model = doc2vec.load_existing_model(
        model_file_name=
        'doc2vec_single_language_full_model_german_18_Feb_2018_22_31_27')

    tsne_model = tsne.load_tsne_model(
        model_file_name=
        't_sne_single_language_full_model_doc2vec_model_german_20_Feb_2018_08_56_12.npy'
    )

    agglomerative_clustering(
        doc2vec_model,
        tsne_model,
        numbers_of_clusters=[5, 10, 15, 20, 25, 30],
        model_language='single-language_full_model-german')
    '''
Beispiel #6
0
def create_kmeans_clustering(doc2vec_model_file_path,
                             tsne_model_file_path,
                             model_language,
                             k,
                             save_to_directory,
                             new_hostnames=None):
    """helper function to create K-Means clustering plot
    :param doc2vec_model_file_path: file path of doc2vec model
    :param tsne_model_file_path: file path of tsne model
    other parameters are explained in dbscan_clustering function

    """

    doc2vec_model = doc2vec.load_existing_model(
        doc2vec_model_file_path=doc2vec_model_file_path)
    tsne_model = tsne.load_tsne_model(
        tsne_model_file_path=tsne_model_file_path)

    kmeans_clustering(doc2vec_model=doc2vec_model,
                      tsne_model=tsne_model,
                      model_language=model_language,
                      k=k,
                      new_hostnames=new_hostnames,
                      save_to_directory=save_to_directory)
def create_agglomerative_clustering(doc2vec_model_file_path,
                                    tsne_model_file_path,
                                    numbers_of_clusters,
                                    model_language,
                                    save_to_directory,
                                    new_hostnames=None):
    """helper function to create agglomerative clustering plot
    :param doc2vec_model_file_path: file path of doc2vec model
    :param tsne_model_file_path: file path of tsne model
    other parameters are explained in agglomerative_clustering function

    """

    doc2vec_model = doc2vec.load_existing_model(
        doc2vec_model_file_path=doc2vec_model_file_path)
    tsne_model = tsne.load_tsne_model(
        tsne_model_file_path=tsne_model_file_path)

    agglomerative_clustering(doc2vec_model=doc2vec_model,
                             tsne_model=tsne_model,
                             numbers_of_clusters=numbers_of_clusters,
                             model_language=model_language,
                             new_hostnames=new_hostnames,
                             save_to_directory=save_to_directory)
Beispiel #8
0
def main():
    '''
    # example usage for create K-Means Clustering
    doc2vec_model = doc2vec.load_existing_model(
        model_file_name='doc2vec_single_language_full_model_german_18_Feb_2018_22_31_27')

    tsne_model = tsne.load_tsne_model(
        model_file_name='t_sne_single_language_full_model_doc2vec_model_german_20_Feb_2018_08_56_12.npy')

    kmeans_clustering(doc2vec_model,
                      tsne_model,
                      model_language='single_language_full_german',
                      k=10)

    
    # example with K-Means and new added data points
    doc2vec_model = doc2vec.load_existing_model(
        model_file_name='doc2vec_single_language_full_model_german_18_Feb_2018_22_31_27')

    tsne_model = tsne.load_tsne_model(
        model_file_name='t_sne_s_l_full_doc2vec_model_new_data_german_20_Feb_2018_09_58_50.npy')

    kmeans_clustering(doc2vec_model,
                      tsne_model,
                      model_language='s-l-full-model-new-data-german',
                      new_hostnames=['upkbs.ch',
                                                                                              'curaneo.ch',
                                                                                              'bscyb.ch',
                                                                                              'scltigers.ch',
                                                                                              'graubuenden.ch'],
                      k=10)
    '''

    # Live-Demo pt. 1

    doc2vec_model = doc2vec.load_existing_model(
        model_file_name=
        'doc2vec_single_language_full_model_german_18_Feb_2018_22_31_27')

    tsne_model = tsne.load_tsne_model(
        model_file_name='t-sne-live-demo-german-07-Mar-2018-09:08:12.npy')

    kmeans_clustering(doc2vec_model,
                      tsne_model,
                      model_language='live-demo-german',
                      new_hostnames=['triaplus.ch', 'fcaarau.ch'],
                      k=10)

    # Live-Demo pt. 2

    doc2vec_model = doc2vec.load_existing_model(
        model_file_name=
        'doc2vec_single_language_full_model_english_18_Feb_2018_22_31_27')

    tsne_model = tsne.load_tsne_model(
        model_file_name='t-sne-live-demo-english-07-Mar-2018-09:08:18.npy')

    kmeans_clustering(doc2vec_model,
                      tsne_model,
                      model_language='live-demo-english',
                      new_hostnames=['hostelscentral.com'],
                      k=10)