pucktrick 0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pucktrick/__init__.py ADDED
File without changes
@@ -0,0 +1,76 @@
1
+ from pucktrick.utils import *
2
+ import pandas as pd
3
+
4
+
5
+ def duplicateAllNew(train_df,percentage):
6
+ rowsToChange=len(train_df)*percentage
7
+ old_duplicated=train_df.duplicated().sum()
8
+ new_rowsToChange=rowsToChange-old_duplicated
9
+ if new_rowsToChange<=0:
10
+ return train_df
11
+ percentage=new_rowsToChange/len(train_df)
12
+ noise_df= train_df.copy()
13
+ df_len=len(noise_df)
14
+ extracted_list=sampleList(percentage,df_len)
15
+ new_lines=int(df_len*percentage)
16
+ for i in range(new_lines):
17
+ tmpdf=train_df.loc[generate_random_value_discrete(0,len(extracted_list))].copy()
18
+ noise_df.loc[len(noise_df)] = tmpdf
19
+ return noise_df
20
+
21
+ def duplicateAllExtended(original_df, train_df,percentage):
22
+ rowsToChange=len(original_df)*percentage
23
+ old_duplicated=original_df.duplicated().sum()
24
+ new_duplicated=train_df.duplicated().sum()
25
+ diff=new_duplicated-old_duplicated
26
+ new_rowsToChange=rowsToChange-diff
27
+ if new_rowsToChange<=0:
28
+ return train_df
29
+ new_percentage=new_rowsToChange/len(original_df)
30
+ noise_df= train_df.copy()
31
+ extracted_list=sampleList(new_percentage,len(original_df))
32
+ new_lines=int(len(original_df)*new_percentage)
33
+ for i in range(new_lines):
34
+ tmpdf=train_df.loc[generate_random_value_discrete(0,len(extracted_list))].copy()
35
+ noise_df.loc[len(noise_df)] = tmpdf
36
+ return noise_df
37
+
38
+ def duplicateClassNew(train_df,target, value,percentage):
39
+ target_df=train_df[train_df[target] ==value]
40
+ target_df = target_df.reset_index(drop=True)
41
+ rowsToChange=int(len(target_df)*percentage)
42
+ old_duplicated=target_df.duplicated().sum()
43
+ new_rowsToChange=rowsToChange-old_duplicated
44
+ if new_rowsToChange<=0:
45
+ return train_df
46
+ percentage=new_rowsToChange/len(target_df)
47
+ noise_df= train_df.copy()
48
+ df_len=len(target_df)
49
+ extracted_list=sampleList(percentage,df_len)
50
+ for i in range(new_rowsToChange):
51
+ row=generate_random_value_discrete(0,len(extracted_list))
52
+ tmpdf=target_df.loc[row].copy()
53
+ noise_df.loc[len(noise_df)] = tmpdf
54
+ return noise_df
55
+
56
+ def duplicateClassExtended(original_df, train_df,target, value,percentage):
57
+ origin_target_df=original_df[original_df[target] ==value]
58
+ target_df=train_df[train_df[target] ==value]
59
+ target_df = target_df.reset_index(drop=True)
60
+ origin_target_df = origin_target_df.reset_index(drop=True)
61
+ rowsToChange=len(origin_target_df)*percentage
62
+ old_duplicated=origin_target_df.duplicated().sum()
63
+ new_duplicated=target_df.duplicated().sum()
64
+ diff=new_duplicated-old_duplicated
65
+ new_rowsToChange=int(rowsToChange-diff)
66
+ if new_rowsToChange<=0:
67
+ return train_df
68
+ percentage=new_rowsToChange/len(origin_target_df)
69
+ noise_df= train_df.copy()
70
+ df_len=len(origin_target_df)
71
+ extracted_list=sampleList(percentage,df_len)
72
+ for i in range(new_rowsToChange):
73
+ row=generate_random_value_discrete(0,len(extracted_list))
74
+ tmpdf=origin_target_df.loc[row].copy()
75
+ noise_df.loc[len(noise_df)] = tmpdf
76
+ return noise_df
pucktrick/labels.py ADDED
@@ -0,0 +1,28 @@
1
+ from pucktrick.utils import *
2
+ from pucktrick.noisy import *
3
+
4
+ def wrongLabelsBinaryExtended(original_df, train_df,column,percentage):
5
+ noise_df= train_df.copy()
6
+ noise_df['id1'] = range(len(noise_df))
7
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
8
+ if newPercentage==0:
9
+ return train_df
10
+ modified_df= noiseBinaryNew(new_df,column,newPercentage)
11
+ noise_df=mergeDataframe(noise_df,modified_df)
12
+ noise_df[column] = noise_df[column].fillna(0)
13
+ return noise_df
14
+
15
+ def wrongLabelsBinaryNew(train_df,target,percentage):
16
+ noise_df=noiseBinaryNew(train_df,target,percentage)
17
+ return noise_df
18
+
19
+ def wrongLabelsCategoricalNew(train_df,target,percentage):
20
+ noise_df=noiseCategoricalIntNewExistingValues(train_df,target,percentage)
21
+ return noise_df
22
+
23
+ def wrongLabelsCategoryExtended(train_df,target,percentage):
24
+ noise_df=noiseCategoricalIntExtendedExistingValues(train_df,target,percentage)
25
+ return noise_df
26
+
27
+
28
+
pucktrick/missing.py ADDED
@@ -0,0 +1,29 @@
1
+ from pucktrick.utils import *
2
+ from pucktrick.noisy import *
3
+ import pandas as pd
4
+ import numpy as np
5
+
6
+ def missingNew(train_df,column,percentage):
7
+ extracted_list=sampleList(percentage,len(train_df[column]))
8
+ noise_df= train_df.copy()
9
+ for i, value in enumerate(extracted_list):
10
+ noise_df.loc[i, column] = np.nan
11
+ return noise_df
12
+
13
+ def missingExtended(original_df,train_df,column,percentage):
14
+ noise_df= train_df.copy()
15
+ noise_df['id1'] = range(len(noise_df))
16
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
17
+ if newPercentage==0:
18
+ return train_df
19
+ modified_df= missingNew(new_df,column,newPercentage)
20
+ i=0
21
+ for index in modified_df['id1']:
22
+ if pd.isnull(modified_df[modified_df['id1']==index][column]).any() and pd.notnull(noise_df[noise_df['id1']==index][column]).any():
23
+ i += 1
24
+ indexer=noise_df[noise_df['id1']==index].index
25
+ noise_df.loc[indexer,column] = np.nan
26
+ noise_df = noise_df.drop('id1', axis=1)
27
+ return noise_df
28
+
29
+
pucktrick/noisy.py ADDED
@@ -0,0 +1,143 @@
1
+ from pucktrick.utils import *
2
+ import pandas as pd
3
+
4
+
5
+ def noiseCategoricalStringNewExistingValues(train_df,column,percentage):
6
+ extracted_list=sampleList(percentage,len(train_df[column]))
7
+ noise_df= train_df.copy()
8
+ unique_values = noise_df[column].unique()
9
+ for i, value in enumerate(extracted_list):
10
+ while True:
11
+ new_value=np.random.choice(unique_values)
12
+ if new_value != noise_df.loc[i, column]:
13
+ noise_df.loc[i, column] = new_value
14
+ break
15
+ return noise_df
16
+
17
+
18
+
19
+
20
+ def noiseCategoricalStringExtendedExistingValues(original_df, train_df,column,percentage):
21
+ noise_df= train_df.copy()
22
+ noise_df['id1'] = range(len(noise_df))
23
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
24
+ if newPercentage==0:
25
+ return train_df
26
+ modified_df= noiseCategoricalStringNewExistingValues(new_df,column,newPercentage)
27
+ noise_df=mergeDataframe(noise_df,modified_df)
28
+ return noise_df
29
+
30
+ def noiseCategoricalStringNewFakeValues(train_df,column,percentage):
31
+ extracted_list=sampleList(percentage,len(train_df[column]))
32
+ noise_df= train_df.copy()
33
+ unique_values = noise_df[column].unique()
34
+ for i, value in enumerate(extracted_list):
35
+ noise_df.loc[i, column] = ''.join(np.random.choice(list('abcdefghijklmnopqrstuvwxyz'), size=5))
36
+ return noise_df
37
+
38
+ def noiseCategoricalStringExstendedFakeValues(original_df, train_df,column,percentage):
39
+ noise_df= train_df.copy()
40
+ noise_df['id1'] = range(len(noise_df))
41
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
42
+ if newPercentage==0:
43
+ return train_df
44
+ modified_df= noiseCategoricalStringNewFakeValues(new_df,column,newPercentage)
45
+ noise_df=mergeDataframe(noise_df,modified_df)
46
+ return noise_df
47
+
48
+ def noiseCategoricalIntNewExistingValues(train_df,column,percentage):
49
+ extracted_list=sampleList(percentage,len(train_df[column]))
50
+ noise_df= train_df.copy()
51
+ unique_values = noise_df[column].unique()
52
+ for i, value in enumerate(extracted_list):
53
+ while True:
54
+ new_value=np.random.choice(unique_values)
55
+ if new_value != noise_df.loc[i, column]:
56
+ noise_df.loc[i, column] = new_value
57
+ break
58
+ return noise_df
59
+
60
+ def noiseCategoricalIntExtendedExistingValues(original_df, train_df,column,percentage):
61
+ noise_df= train_df.copy()
62
+ noise_df['id1'] = range(len(noise_df))
63
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
64
+ if newPercentage==0:
65
+ return train_df
66
+ modified_df= noiseCategoricalStringNewExistingValues(new_df,column,newPercentage)
67
+ noise_df=mergeDataframe(noise_df,modified_df)
68
+ return noise_df
69
+
70
+
71
+
72
+ def noiseDiscreteExtended(original_df, train_df,column,percentage):
73
+ noise_df= train_df.copy()
74
+ noise_df['id1'] = range(len(noise_df))
75
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
76
+ if newPercentage==0:
77
+ return train_df
78
+ modified_df= noiseDiscreteNew(new_df,column,newPercentage)
79
+ noise_df=mergeDataframe(noise_df,modified_df)
80
+ return noise_df
81
+
82
+
83
+ def noiseDiscreteNew(train_df,column,percentage):
84
+ extracted_list=sampleList(percentage,len(train_df[column]))
85
+ noise_df= train_df.copy()
86
+ min = noise_df[column].min()
87
+ max = noise_df[column].max()
88
+
89
+ for i, value in enumerate(extracted_list):
90
+ while True:
91
+ new_value=random.randint(min,max)
92
+ if new_value != noise_df.loc[i, column]:
93
+ noise_df.loc[i, column] = new_value
94
+ break
95
+ return noise_df
96
+
97
+
98
+ def noiseBinaryNew(train_df,target,percentage):
99
+ noise_df= train_df.copy()
100
+ extracted_list=sampleList(percentage,len(noise_df[target])-1)
101
+ for i, value in enumerate(extracted_list):
102
+ if pd.isna(noise_df.loc[i, target]):
103
+ noise_df.loc[i, target]=0
104
+ else:
105
+ existingValue=noise_df.loc[i, target]
106
+ noise_df.loc[i, target]=1-existingValue
107
+ return noise_df
108
+
109
+ def noiseBinaryExtended(original_df, train_df,column,percentage):
110
+ noise_df= train_df.copy()
111
+ noise_df['id1'] = range(len(noise_df))
112
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
113
+ if newPercentage==0:
114
+ return train_df
115
+ modified_df= noiseBinaryNew(new_df,column,newPercentage)
116
+ noise_df=mergeDataframe(noise_df,modified_df)
117
+ return noise_df
118
+ def noiseContinueExtended(original_df, train_df,column,percentage):
119
+ noise_df= train_df.copy()
120
+ noise_df['id1'] = range(len(noise_df))
121
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
122
+ if newPercentage==0:
123
+ return train_df
124
+ modified_df= noiseContinueNew(new_df,column,newPercentage)
125
+ noise_df=mergeDataframe(noise_df,modified_df)
126
+ return noise_df
127
+
128
+
129
+ def noiseContinueNew(train_df,column,percentage):
130
+ extracted_list=sampleList(percentage,len(train_df[column]))
131
+ noise_df= train_df.copy()
132
+ min = noise_df[column].min()
133
+ max = noise_df[column].max()
134
+
135
+ for i, value in enumerate(extracted_list):
136
+ while True:
137
+ new_value=random.uniform(min,max)
138
+ if new_value != noise_df.loc[i, column]:
139
+ noise_df.loc[i, column] = new_value
140
+ break
141
+ return noise_df
142
+
143
+
pucktrick/outliers.py ADDED
@@ -0,0 +1,92 @@
1
+ from pucktrick.utils import *
2
+ from pucktrick.noisy import *
3
+ import pandas as pd
4
+
5
+ def outlierContinuosNew3Sigma(train_df,column,percentage):
6
+ extracted_list=sampleList(percentage,len(train_df[column]))
7
+ noise_df= train_df.copy()
8
+ mean = np.mean(noise_df[column])
9
+ std_dev = np.std(noise_df[column])
10
+ upper_bound=mean + 3 * std_dev
11
+ lower_bound=mean -3 * std_dev
12
+ new_upper_limit = mean + 4 * std_dev
13
+ new_lower_limit = mean - 4 * std_dev
14
+ for i, value in enumerate(extracted_list):
15
+ if np.random.rand() > 0.5:
16
+ noise_df.loc[i, column] = generate_random_value(upper_bound, new_upper_limit)
17
+ else:
18
+ noise_df.loc[i, column] = generate_random_value(new_lower_limit, lower_bound)
19
+
20
+ return noise_df
21
+
22
+ def outlierContinuosExtended3Sigma(original_df, train_df,column,percentage):
23
+ noise_df= train_df.copy()
24
+ noise_df['id1'] = range(len(noise_df))
25
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
26
+ if newPercentage==0:
27
+ return train_df
28
+ modified_df= outlierContinuosNew3Sigma(new_df,column,newPercentage)
29
+ noise_df=mergeDataframe(noise_df,modified_df)
30
+ return noise_df
31
+
32
+ def outlierDiscreteNew3Sigma(train_df,column,percentage):
33
+ extracted_list=sampleList(percentage,len(train_df[column]))
34
+ noise_df= train_df.copy()
35
+ mean = np.mean(noise_df[column])
36
+ std_dev = np.std(noise_df[column])
37
+ upper_bound=mean + 3 * std_dev
38
+ lower_bound=mean -3 * std_dev
39
+ new_upper_limit = mean + 4 * std_dev
40
+ new_lower_limit = mean - 4 * std_dev
41
+ for i, value in enumerate(extracted_list):
42
+ if np.random.rand() > 0.5:
43
+ noise_df.loc[i, column] = generate_random_value_discrete(upper_bound, new_upper_limit)
44
+ else:
45
+ noise_df.loc[i, column] = generate_random_value_discrete(new_lower_limit, lower_bound)
46
+
47
+ return noise_df
48
+
49
+ def outlierDiscreteExtended3Sigma(original_df, train_df,column,percentage):
50
+ noise_df= train_df.copy()
51
+ noise_df['id1'] = range(len(noise_df))
52
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
53
+ if newPercentage==0:
54
+ return train_df
55
+ modified_df= outlierDiscreteNew3Sigma(new_df,column,newPercentage)
56
+ noise_df=mergeDataframe(noise_df,modified_df)
57
+ return noise_df
58
+
59
+ def outlierCategoricalIntegerNew(train_df,column,percentage):
60
+ extracted_list=sampleList(percentage,len(train_df[column]))
61
+ noise_df= train_df.copy()
62
+ max_value = noise_df[column].max()
63
+ for i, value in enumerate(extracted_list):
64
+ noise_df.loc[i, column] = np.random.randint(max_value, 2*max_value)
65
+ return noise_df
66
+
67
+ def outliercategoricalIntegerExtended(original_df, train_df,column,percentage):
68
+ noise_df= train_df.copy()
69
+ noise_df['id1'] = range(len(noise_df))
70
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
71
+ if newPercentage==0:
72
+ return train_df
73
+ modified_df= outlierCategoricalIntegerNew(new_df,column,newPercentage)
74
+ noise_df=mergeDataframe(noise_df,modified_df)
75
+ return noise_df
76
+
77
+ def outlierCategoricalStringNew(train_df,column,percentage):
78
+ extracted_list=sampleList(percentage,len(train_df[column]))
79
+ noise_df= train_df.copy()
80
+ for i, value in enumerate(extracted_list):
81
+ noise_df.loc[i, column] = "puck was here"
82
+ return noise_df
83
+
84
+ def outliercategoricalStringExtended(original_df, train_df,column,percentage):
85
+ noise_df= train_df.copy()
86
+ noise_df['id1'] = range(len(noise_df))
87
+ new_df,newPercentage=generateSubdf(original_df, noise_df,column,percentage)
88
+ if newPercentage==0:
89
+ return train_df
90
+ modified_df= outlierCategoricalStringNew(new_df,column,newPercentage)
91
+ noise_df=mergeDataframe(noise_df,modified_df)
92
+ return noise_df
pucktrick/utils.py ADDED
@@ -0,0 +1,61 @@
1
+ import random
2
+ import pandas as pd
3
+ import numpy as np
4
+
5
+ def create_fake_table(num_rows=1000):
6
+ # Generate data for each column
7
+ f1 = np.random.uniform(-100, 100, num_rows) # Continuous values between -100 and 100
8
+ f2 = np.random.randint(-100, 101, num_rows) # Discrete values between -100 and 100
9
+ f3 = np.random.choice(['apple', 'banana', 'cherry'], num_rows) # String values
10
+ f4 = np.random.choice(['apple', 'banana', 'cherry'], num_rows) # String values
11
+ f5 = np.random.choice([0, 1], num_rows) # Binary values (0 or 1)
12
+ target = np.random.choice([0, 1], num_rows) # Binary target (0 or 1)
13
+
14
+ # Create the DataFrame
15
+ df = pd.DataFrame({
16
+ 'f1': f1,
17
+ 'f2': f2,
18
+ 'f3': f3,
19
+ 'f4': f4,
20
+ 'f5': f5,
21
+ 'target': target
22
+ })
23
+ return df
24
+
25
+ def sampleList(percentage, maxValueList ):
26
+ values = int(maxValueList * (percentage))
27
+ extracted_List= random.sample(range(1, maxValueList), values)
28
+ return extracted_List
29
+
30
+ def generateSubdf(original_df, train_df,column,percentage ):
31
+ rowsToChange=len(original_df[column])*percentage
32
+ dif = original_df[column] != train_df[column]
33
+ diff_number = dif.sum()
34
+ new_rowsToChange=rowsToChange-diff_number
35
+ if new_rowsToChange<=0:
36
+ newPercentage=0
37
+ return train_df,newPercentage
38
+ noise_df= train_df.copy()
39
+ noise_df['id1'] = range(len(noise_df))
40
+ or_df=original_df.copy()
41
+ or_df['id1'] = range(len(or_df))
42
+ mask = or_df[column] == noise_df[column]
43
+ new_df = noise_df[mask]
44
+ new_df = new_df.reset_index(drop=True)
45
+ newPercentage=new_rowsToChange/len(new_df)
46
+ return new_df,newPercentage
47
+
48
+ def mergeDataframe(noise_df,modified_df):
49
+
50
+ merged_df = noise_df.merge(modified_df, on='id1', how='left', suffixes=('_df1', '_df2'))
51
+ new_array = [string for string in noise_df.columns if string != 'id1']
52
+ for col in new_array:
53
+ noise_df[col] = merged_df[col + '_df2'].fillna(merged_df[col + '_df1'])
54
+ noise_df = noise_df.drop('id1', axis=1)
55
+ return noise_df
56
+
57
+ def generate_random_value(lower, upper):
58
+ return np.random.uniform(lower, upper)
59
+
60
+ def generate_random_value_discrete(lower, upper):
61
+ return np.random.randint(lower, upper)
@@ -0,0 +1,79 @@
1
+ Attribution-NonCommercial 4.0 International
2
+ By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
3
+
4
+ Section 1 – Definitions.
5
+ Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
6
+ Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
7
+ Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
8
+ Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
9
+ Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
10
+ Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
11
+ Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
12
+ Licensor means the individual(s) or entity(ies) granting rights under this Public License.
13
+ NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
14
+ Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
15
+ Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
16
+ You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
17
+ Section 2 – Scope.
18
+ License grant .
19
+ Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
20
+ reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
21
+ produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
22
+ Exceptions and Limitations . For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
23
+ Term . The term of this Public License is specified in Section 6(a) .
24
+ Media and formats; technical modifications allowed . The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
25
+ Downstream recipients .
26
+ Offer from the Licensor – Licensed Material . Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
27
+ No downstream restrictions . You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
28
+ No endorsement . Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i) .
29
+ Other rights .
30
+ Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
31
+ Patent and trademark rights are not licensed under this Public License.
32
+ To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
33
+ Section 3 – License Conditions.
34
+ Your exercise of the Licensed Rights is expressly made subject to the following conditions.
35
+
36
+ Attribution .
37
+ If You Share the Licensed Material (including in modified form), You must:
38
+
39
+ retain the following if it is supplied by the Licensor with the Licensed Material:
40
+ identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
41
+ a copyright notice;
42
+ a notice that refers to this Public License;
43
+ a notice that refers to the disclaimer of warranties;
44
+ a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
45
+ indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
46
+ indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
47
+ You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
48
+ If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
49
+ If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
50
+ Section 4 – Sui Generis Database Rights.
51
+ Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
52
+
53
+ for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
54
+ if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
55
+ You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
56
+ For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
57
+
58
+ Section 5 – Disclaimer of Warranties and Limitation of Liability.
59
+ Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
60
+ To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
61
+ The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
62
+ Section 6 – Term and Termination.
63
+ This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
64
+ Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
65
+
66
+ automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
67
+ upon express reinstatement by the Licensor.
68
+ For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
69
+
70
+ For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
71
+ Sections 1 , 5 , 6 , 7 , and 8 survive termination of this Public License.
72
+ Section 7 – Other Terms and Conditions.
73
+ The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
74
+ Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
75
+ Section 8 – Interpretation.
76
+ For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
77
+ To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
78
+ No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
79
+ Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.1
2
+ Name: pucktrick
3
+ Version: 0.4
4
+ Summary: A python library for error genration in dataset for machine learning
5
+ Home-page: https://github.com/andreamaurino/pucktrick
6
+ Author: Andrea Maurino
7
+ Author-email: andrea.maurino@unimib.it
8
+ License: CC BY-NC 4.0
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: Other/Proprietary License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.6
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENCE
15
+ Requires-Dist: numpy
16
+
17
+ # pucktrick
18
+
19
+ Pucktrick is a Python library that provides various utility functions to introduce errors in your dataframe.
20
+ The name of library is based on Puck. Puck is the name of the elf in the “A midsummer Night’s dream” of William Shakespeare that is very famous to enjoys causing trouble and playing tricks on mortals and other fairies alike.
21
+
22
+
23
+ ## Features
24
+ pucktrick is organized in modules, one for error type
25
+
26
+ each module inludes functions whose name follows this syntax
27
+ errornametypeDataTYpeTypePercentuageOther where
28
+ - errornameType: noisy, inconsitency labels, outlier,
29
+ - DataTYpe: continous, discrete, ….
30
+ - Typepercentage, (New add new error in the dataframe, Extend add more errors in a prexisting dataframe made dirty by pucktrick,
31
+ - Other: eg. fakeValues in case the function add fake values, and so on
32
+
33
+
34
+
35
+ ## Version
36
+ versione 0.4
37
+ - errortype added: missing values
38
+ version 0.3
39
+ -error type added: duplicated
40
+ version 0.2
41
+ - error type inserted: outliers
42
+ version 0.1
43
+
44
+ - error type inserted: noisy error and inconsistency labels
45
+
46
+
47
+ ## Installation
48
+
49
+ You can install pucktrick using pip:
50
+
51
+ pip install pucktrick
52
+
53
+ ## Usage
54
+ to be done
55
+
56
+ ## References
57
+
58
+ ## Contributing
59
+ We welcome contributions from the community. To contribute:
60
+
61
+ Fork the repository
62
+ Create a new branch (git checkout -b feature/your-feature)
63
+ Commit your changes (git commit -am 'Add new feature')
64
+ Push to the branch (git push origin feature/your-feature)
65
+ Create a new Pull Request
66
+ Please ensure your code adheres to our coding standards and includes appropriate tests.
67
+
68
+ License
69
+ This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) - see the LICENSE file for details.
70
+
71
+ Acknowledgements
72
+ Thanks to the contributors and open-source community for their support.
@@ -0,0 +1,12 @@
1
+ pucktrick/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pucktrick/duplicated.py,sha256=jCUfIuDH49nwfMIxOt8H8HOd0YcCl2sPSaiJmUdSJ14,3030
3
+ pucktrick/labels.py,sha256=t1-l2AZCMm_oZPAzPWLee_I3xpNrqhvnoC06yLBhzIY,1000
4
+ pucktrick/missing.py,sha256=Zqo3G-32G_lIit0YGx9UerI1QCyUktfsC3gRU1qezL4,1064
5
+ pucktrick/noisy.py,sha256=i3qc7mxKSd0Wi-_EiSGCKxs8L4OgbUN65sB97ZbAhs8,5298
6
+ pucktrick/outliers.py,sha256=zkW5y47ISiNfgei1hRo5cYwNIx2vu61V5EY_sqR1mE8,3711
7
+ pucktrick/utils.py,sha256=Cq-OJ5w1uJrpZ63sOwDNQi_nMsgolD7cZGWEGcjkiIw,2229
8
+ pucktrick-0.4.dist-info/LICENCE,sha256=XKRwLI_hmo9lR6hedNC9_Uiu4d-jykyQd7YAFWiXvds,13372
9
+ pucktrick-0.4.dist-info/METADATA,sha256=aRJUZ7EezYwoO_ofV8WNp8WzXIzACc9t8QPSxdcXu2M,2394
10
+ pucktrick-0.4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
11
+ pucktrick-0.4.dist-info/top_level.txt,sha256=rxJAW8Pa6CPGlt95g4yCYw0ui0IQV-KbfRuqOiaEups,10
12
+ pucktrick-0.4.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.38.4)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ pucktrick