Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation update #378

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions PAMI/partialPeriodicPatternInMultipleTimeSeries/PPGrowth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# PPGrowth is one of the fundamental algorithm to discover periodic-frequent patterns in a transactional database.
#
# **Importing this algorithm into a python program**
# --------------------------------------------------------
#
#
# from PAMI.periodicFrequentPattern.basic import PPGrowth as alg
#
Expand All @@ -27,6 +25,8 @@
# print("Total Memory in RSS", memRSS)
#
# run = obj.getRuntime()
#
# print("Total ExecutionTime in seconds:", run)


__copyright__ = """
Expand All @@ -44,7 +44,7 @@

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2021 Rage Uday Kiran


"""

Expand Down Expand Up @@ -312,6 +312,9 @@ def generatePatterns(self, prefix):

class PPGrowth(_ab._partialPeriodicPatterns):
"""
About this algorithm
====================

:Description: PPGrowth is one of the fundamental algorithm to discover periodic-frequent patterns in a transactional database.

:Reference: C. Saideep, R. Uday Kiran, K. Zettsu, P. Fournier-Viger, M. Kitsuregawa and P. Krishna Reddy,
Expand Down Expand Up @@ -393,11 +396,15 @@ class PPGrowth(_ab._partialPeriodicPatterns):
convert()
to convert the user specified value

**Executing the code on terminal:**
-------------------------------------
.. code-block:: console
Execution methods
=================


**Terminal command**


.. code-block:: console

Format:

(.venv) $ python3 PPGrowth.py <inputFile> <outputFile> <minSup> <maxPer>
Expand Down Expand Up @@ -437,7 +444,9 @@ class PPGrowth(_ab._partialPeriodicPatterns):

**Credits:**
--------------
The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.\n


The complete program was written by P.Likhitha under the supervision of Professor Rage Uday Kiran.

"""
_startTime = float()
Expand Down Expand Up @@ -495,7 +504,6 @@ def _creatingItemSets(self):
print("File Not Found")
quit()


def _periodicFrequentOneItem(self):
"""
Calculates the support of each item in the database and assign ranks to the items
Expand Down
21 changes: 20 additions & 1 deletion PAMI/partialPeriodicPatternInMultipleTimeSeries/abstract.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Copyright (C) 2021 Rage Uday Kiran
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from abc import ABC as _ABC, abstractmethod as _abstractmethod
import time as _time
import math as _math
Expand All @@ -15,6 +30,9 @@

class _partialPeriodicPatterns(_ABC):
"""
About this algorithm
====================

:Description: This abstract base class defines the variables and methods that every frequent pattern mining algorithm must
employ in PAMI

Expand Down Expand Up @@ -83,6 +101,7 @@ def iFile(self):
def periodicSupport(self):
"""Variable to store the user-specified minimum support value"""
pass
@abstractmethod
def period(self):
"""Variable to store the user specified maximum periodicity value"""
pass
Expand Down Expand Up @@ -162,6 +181,6 @@ def getRuntime(self):

@_abstractmethod
def printResults(self):
""" To print all the results of execution"""
""" To print the results of execution"""

pass
15 changes: 10 additions & 5 deletions PAMI/periodicCorrelatedPattern/basic/EPCPGrowth.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ def startMine(self) -> None:
print("Correlated Periodic-Frequent patterns were generated successfully using EPCPGrowth algorithm ")

def getMemoryUSS(self) -> float:
"""Total amount of USS memory consumed by the mining process will be retrieved from this function
"""
Total amount of USS memory consumed by the mining process will be retrieved from this function

:return: returning USS memory consumed by the mining process
:rtype: float
Expand All @@ -655,7 +656,8 @@ def getMemoryUSS(self) -> float:
return self._memoryUSS

def getMemoryRSS(self) -> float:
"""Total amount of RSS memory consumed by the mining process will be retrieved from this function
"""
Total amount of RSS memory consumed by the mining process will be retrieved from this function

:return: returning RSS memory consumed by the mining process
:rtype: float
Expand All @@ -664,7 +666,8 @@ def getMemoryRSS(self) -> float:
return self._memoryRSS

def getRuntime(self) -> float:
"""Calculating the total amount of runtime taken by the mining process
"""
Calculating the total amount of runtime taken by the mining process


:return: returning total amount of runtime taken by the mining process
Expand All @@ -674,7 +677,8 @@ def getRuntime(self) -> float:
return self._endTime - self._startTime

def getPatternsAsDataFrame(self) -> pd.DataFrame:
"""Storing final periodic-frequent patterns in a dataframe
"""
Storing final periodic-frequent patterns in a dataframe

:return: returning periodic-frequent patterns in a dataframe
:rtype: pd.DataFrame
Expand All @@ -688,7 +692,8 @@ def getPatternsAsDataFrame(self) -> pd.DataFrame:
return dataFrame

def save(self, outFile: str) -> None:
"""Complete set of periodic-frequent patterns will be loaded in to an output file
"""
Complete set of periodic-frequent patterns will be loaded in to an output file

:param outFile: name of the output file
:type outFile: csv file
Expand Down
3 changes: 3 additions & 0 deletions PAMI/periodicCorrelatedPattern/basic/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

class _periodicCorrelatedPatterns(_ABC):
"""
About this algorithm
====================

:Description: This abstract base class defines the variables and methods that every periodic-frequent pattern mining algorithm must
employ in PAMI

Expand Down
2 changes: 1 addition & 1 deletion PAMI/periodicFrequentPattern/basic/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ def getRuntime(self):

@_abstractmethod
def printResults(self):
""" To print results of the execution."""
""" To print the results of the execution."""

pass
29 changes: 18 additions & 11 deletions PAMI/periodicFrequentPattern/closed/CPFPMiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@

from PAMI.periodicFrequentPattern.closed import abstract as _ab


class CPFPMiner(_ab._periodicFrequentPatterns):
"""
"""
About this algorithm
====================

:Description: CPFPMiner algorithm is used to discover the closed periodic frequent patterns in temporal databases.
It uses depth-first search.

Expand Down Expand Up @@ -127,10 +129,15 @@ class CPFPMiner(_ab._periodicFrequentPatterns):
getRuntime()
Total amount of runtime taken by the mining process will be retrieved from this function

**Methods to execute code on terminal**
--------------------------------------------
.. code-block:: console

Execution methods
=================


**Terminal command**


.. code-block:: console

Format:

Expand All @@ -140,14 +147,13 @@ class CPFPMiner(_ab._periodicFrequentPatterns):

(.venv) $ python3 CPFPMiner.py sampleTDB.txt patterns.txt 0.3 0.4


.. note:: minSup will be considered in percentage of database transactions
.. note:: minSup will be considered in percentage of database transactions


**Importing this algorithm into a python program**
-------------------------------------------------------
**Calling from a python program**

.. code-block:: python

from PAMI.periodicFrequentPattern.closed import CPFPMiner as alg

obj = alg.CPFPMiner("../basic/sampleTDB.txt", "2", "6")
Expand Down Expand Up @@ -224,6 +230,7 @@ def _convert(self, value):
def _scanDatabase(self):
"""
To scan the database and extracts the 1-length periodic-frequent items

:return: Returns the 1-length periodic-frequent items
"""
Database = []
Expand Down Expand Up @@ -381,7 +388,7 @@ def _save(self, prefix, suffix, tidSetX):

def _processEquivalenceClass(self, prefix, itemSets, tidSets):
"""

identifies and saves closed periodic patterns of length more than 2 in a dataset, by processing equivalence classes of item sets that satisfy a minimum support condition.
:param prefix: Prefix class of an itemSet
:param itemSets: suffix items in periodicFrequentItems that satisfies the minSup condition
:param tidSets: timeStamps of items in itemSets respectively
Expand Down
2 changes: 1 addition & 1 deletion PAMI/periodicFrequentPattern/closed/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ def getRuntime(self):

@_abstractmethod
def printResults(self):
""" TO print the results of execution """
""" To print the results of execution """

pass