コード例 #1
0
    def __init__(self, users, eps, MinPts, reduce_dimensions=False):
        if reduce_dimensions:
            autoencoder = AutoEncoder(users)
            users = autoencoder.reduce_dimensions(
            )  # num_dimensions should be bigger than 4. else it runs for 4.

        self.userLength = users.shape[0]
        self.eps = eps
        self.MinPts = MinPts
        self.DistanceMatrix = self.__calcDistanceMatrix(users)
コード例 #2
0
    def __init__(self, train, test, reduce_dimensions=False):
        self.train_data = train
        self.test_data = test
        labels = self.extractLabels(self.train_data)

        if reduce_dimensions:
            train_autoencoder = AutoEncoder(self.train_data)
            self.train_data = train_autoencoder.reduce_dimensions()  # num_dimensions should be bigger than 4. else it runs for 4.

            test_autoencoder = AutoEncoder(self.test_data)
            self.test_data = test_autoencoder.reduce_dimensions()

        self.train_data["label"] = labels
コード例 #3
0
    def __init__(self, train, test, reduce_dimensions=False):

        self.train_data = train
        self.test_data = test

        self.train_data = self.train_data.sort_values(
            by='popularity', ascending=False
        )  # test data is also sorted, so in this way i can find them and discriminate them
        self.train_data = self.train_data[self.test_data.shape[
            0]:]  # keep for train only the data that isnt contained in test
        self.train_data.reset_index(drop=True, inplace=True)

        labels = self.extractLabels()

        if reduce_dimensions:
            train_autoencoder = AutoEncoder(self.train_data)
            self.train_data = train_autoencoder.reduce_dimensions(
            )  # num_dimensions should be bigger than 4. else it runs for 4.

            test_autoencoder = AutoEncoder(self.test_data)
            self.test_data = test_autoencoder.reduce_dimensions()

        self.train_data["label"] = labels