-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
113 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class Adapter: | ||
""" | ||
Downloads raw pdb files and/or meta data from a source and formats it to the shake database schema. | ||
""" | ||
|
||
pass |
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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
from pathlib import Path | ||
from .collection import Collection | ||
|
||
|
||
class Database: | ||
""" | ||
Spins up a redis database | ||
""" | ||
|
||
def __init__(self, storage: Path) -> None: | ||
pass | ||
|
||
def update(self) -> None: | ||
pass | ||
|
||
def query(self, query: str) -> Collection: | ||
def query(self, query: str): | ||
pass |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
class Framework: | ||
""" | ||
Abstract class for a framework. Used as Mixin with a Transform. | ||
""" | ||
|
||
def create_loader(self, iterator): | ||
pass | ||
""" | ||
Creates a framework-specific dataloader from an iterator. | ||
""" | ||
raise NotImplementedError |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
class Metric: | ||
"""For a collection of predictions and target values, return set of performance metrics.,""" | ||
""" | ||
Computes a set of relevant metrics for a task. | ||
""" | ||
|
||
pass |
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 |
---|---|---|
@@ -1 +1 @@ | ||
from .evaluator import * | ||
from .dummy_metric import * |
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,7 @@ | ||
from proteinshake.metric import Metric | ||
import numpy as np | ||
|
||
|
||
class DummyMetric(Metric): | ||
def __call__(self, y_true, y_pred): | ||
return {"Accuracy": np.random.random()} |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
class Representation: | ||
""" | ||
Abstract class for a representation. Used as Mixin with a Transform. | ||
""" | ||
|
||
pass |
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 |
---|---|---|
@@ -1,8 +1,17 @@ | ||
from typing import Dict, Iterator | ||
|
||
|
||
class Split: | ||
""" | ||
Abstract class for selecting train/val/test indices given a dataset. | ||
Abstract class to create data splits from a dataset. | ||
""" | ||
|
||
def __call__(self, dataset: Iterator) -> Dict[str, Iterator]: | ||
""" | ||
Takes an Xy iterator and returns a dictionary of Xy iterators, where each key denotes the split name (usually 'train', 'test', and 'val'). | ||
""" | ||
raise NotImplementedError | ||
|
||
@property | ||
def hash(self): | ||
return self.__class__.__name__ |
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 |
---|---|---|
@@ -1 +1 @@ | ||
from .splitter import * | ||
from .dummy_split import * |
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,13 @@ | ||
from proteinshake.split import Split | ||
import itertools | ||
|
||
|
||
class DummySplit(Split): | ||
def __call__(self, Xy): | ||
train, testval = itertools.tee(Xy) | ||
test, val = itertools.tee(testval) | ||
return { | ||
"train": filter(lambda Xy: Xy[0][0]["split"] == "train", train), | ||
"test": filter(lambda Xy: Xy[0][0]["split"] == "test", test), | ||
"val": filter(lambda Xy: Xy[0][0]["split"] == "val", val), | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,13 @@ | ||
from typing import Dict, Iterator | ||
|
||
|
||
class Target: | ||
"""Returns the attribute to predict for a single instance, given arbitrary inputs. | ||
Different tasks will have target computations on different types and numbers of entitites. | ||
""" | ||
Abstract class for reshaping a dataset into the correct data-target structure for a task. | ||
""" | ||
|
||
pass | ||
def __call__(self, dataset: Iterator[dict]) -> Dict[str, Iterator]: | ||
""" | ||
Takes a dataset iterator and returns an Xy iterator, whose elements are ((X1,X2,...), y) pairs of data tuples and targets. | ||
""" | ||
raise NotImplementedError |
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 |
---|---|---|
@@ -1 +1 @@ | ||
from .target import Target | ||
from .attribute_target import AttributeTarget |
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,10 @@ | ||
from proteinshake.target import Target | ||
|
||
|
||
class AttributeTarget(Target): | ||
def __init__(self, attribute) -> None: | ||
super().__init__() | ||
self.attribute = attribute | ||
|
||
def __call__(self, dataset): | ||
return (((p,), p[self.attribute]) for p in dataset) |
This file was deleted.
Oops, something went wrong.
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
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 @@ | ||
from .dummy_task import DummyTask |
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,11 @@ | ||
from proteinshake.task import Task | ||
from proteinshake.metrics import DummyMetric | ||
from proteinshake.targets import AttributeTarget | ||
from proteinshake.splits import DummySplit | ||
|
||
|
||
class DummyTask(Task): | ||
dataset = "test" | ||
split = DummySplit | ||
target = AttributeTarget | ||
metrics = DummyMetric |
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
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