-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. n_jobs is set to None by default to avoid an error. 2. Solve unexpected parameter 'allow_empty_party' Add readme and examples.
- Loading branch information
Showing
7 changed files
with
90 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from sklearn.datasets import make_classification | ||
|
||
# Generate a large dataset | ||
X, y = make_classification(n_samples=10000, n_features=10) | ||
|
||
|
||
from vertibench.Evaluator import ImportanceEvaluator, CorrelationEvaluator | ||
from vertibench.Splitter import ImportanceSplitter, CorrelationSplitter | ||
from sklearn.linear_model import LogisticRegression | ||
|
||
# Split by importance | ||
imp_splitter = ImportanceSplitter(num_parties=4, weights=[1, 1, 1, 3]) | ||
Xs = imp_splitter.split(X) | ||
|
||
# Evaluate split by importance | ||
model = LogisticRegression() | ||
model.fit(X, y) | ||
imp_evaluator = ImportanceEvaluator() | ||
imp_scores = imp_evaluator.evaluate(Xs, model.predict) | ||
alpha = imp_evaluator.evaluate_alpha(scores=imp_scores) | ||
print(f"Importance scores: {imp_scores}, alpha: {alpha}") | ||
|
||
# Split by correlation | ||
corr_splitter = CorrelationSplitter(num_parties=4) | ||
Xs = corr_splitter.fit_split(X) | ||
|
||
# Evaluate split by correlation | ||
corr_evaluator = CorrelationEvaluator() | ||
corr_scores = corr_evaluator.fit_evaluate(Xs) | ||
beta = corr_evaluator.evaluate_beta() | ||
print(f"Correlation scores: {corr_scores}, beta: {beta}") | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters