src.clustering package¶
Subpackages¶
Submodules¶
src.clustering.apps module¶
src.clustering.clustering module¶
clustering methods and functionalities
-
class
src.clustering.clustering.
Clustering
(clustering)¶ Bases:
object
clustering related tasks, stores both the clustered data and the models trained on each cluster
-
cluster_data
(input_df)¶ clusters the input DataFrame
Parameters: input_df ( DataFrame
) – input DataFrameReturn type: dict
Returns: dictionary containing the clustered data
-
fit
(training_df)¶ clusters the input DataFrame
Parameters: training_df ( DataFrame
) – training DataFrameReturn type: None
-
classmethod
load_model
(job)¶
-
predict
(test_df)¶ TODO: complete
Parameters: test_df ( DataFrame
) – testing DataFrameReturn type: Series
Returns: TODO: complete
-
src.clustering.methods_default_config module¶
-
src.clustering.methods_default_config.
clustering_kmeans
()¶
src.clustering.models module¶
-
class
src.clustering.models.
Clustering
(*args, **kwargs)¶ Bases:
src.common.models.CommonModel
Container of Classification to be shown in frontend
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
clustering_method
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_clustering_method_display
(*, field=<django.db.models.fields.CharField: clustering_method>)¶
-
id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
static
init
(clustering='noCluster', configuration={})¶
-
job_set
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
kmeans
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
model_path
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
nocluster
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
-
objects
= <model_utils.managers.InheritanceManager object>¶
-
to_dict
()¶
-
exception
-
class
src.clustering.models.
ClusteringMethods
¶ Bases:
enum.Enum
An enumeration.
-
KMEANS
= 'kmeans'¶
-
NO_CLUSTER
= 'noCluster'¶
-
-
class
src.clustering.models.
KMeans
(id, model_path, clustering_method, clustering_ptr, n_clusters, init, n_init, max_iter, tol, precompute_distances, random_state, copy_x, algorithm)¶ Bases:
src.clustering.models.Clustering
-
exception
DoesNotExist
¶ Bases:
src.clustering.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.clustering.models.MultipleObjectsReturned
-
algorithm
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
clustering_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
clustering_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
copy_x
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
get_algorithm_display
(*, field=<django.db.models.fields.CharField: algorithm>)¶
-
get_init_display
(*, field=<django.db.models.fields.CharField: init>)¶
-
get_precompute_distances_display
(*, field=<django.db.models.fields.CharField: precompute_distances>)¶
-
max_iter
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
n_clusters
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
n_init
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
precompute_distances
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
random_state
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
to_dict
()¶ Return type: dict
-
tol
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception
-
class
src.clustering.models.
NoCluster
(id, model_path, clustering_method, clustering_ptr)¶ Bases:
src.clustering.models.Clustering
-
exception
DoesNotExist
¶ Bases:
src.clustering.models.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
src.clustering.models.MultipleObjectsReturned
-
clustering_ptr
¶ Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
-
clustering_ptr_id
¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
exception