Skip to content

updated with max_ent - #81

Open
Henry-Plante wants to merge 3 commits into
MUEXLY:mainfrom
Henry-Plante:main
Open

updated with max_ent#81
Henry-Plante wants to merge 3 commits into
MUEXLY:mainfrom
Henry-Plante:main

Conversation

@Henry-Plante

Copy link
Copy Markdown

No description provided.

Comment thread main.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a test in test_lib.py, not a whole new file

Comment thread tce/calculator.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good. but it looks like you're using an old version of tce-lib here.

After commit 7fb3ac3, we don't use scipy.spatial.KDTree anymore for the neighbor finding. Also, you re-implemented TCECalculator.get_batched_feature_vectors - this was added in the same commit.

Comment thread tce/calculator.py Outdated
from opt_einsum import contract
from multiset import Multiset

# new import for optimized sorting:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import order should look like:

  • built-ins (standard library modules like typing)
  • third party modules (like numpy, sparse)
  • local modules (like .training)

Comment thread tce/calculator.py Outdated
LATIN_ALPHABET = "ijklmnopqrstuvwxyz"

#max_ent funct for optimized matrix sorting
def maximum_entropy_subset_up_to_size_k(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be a "private" method

i put private in quotes because python doesn't actually have these, but there's a standardized way we can denote it:

  • rename it with an underscore (foo -> _foo)

we also use pdoc to generate documentation and we shouldn't have private functions in the documentation. you can add @private in the doc-string to make sure pdoc doesn't catch it:

https://pdoc.dev/docs/pdoc.html#control-what-is-documented

Comment thread tce/calculator.py Outdated
topological_tensors = self.topological_tensors.get(topology_key)

if topological_tensors is None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old tce-lib version, see the git diff where this error guard doesn't exist

Comment thread tce/calculator.py
return obj

# err handling and center controlling
def get_batched_feature_vectors(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't exist, see comment on file

Comment thread tce/calculator.py
"""
return np.array([self.get_feature_vector(atoms) for atoms in atoms_list])

def select_maximum_entropy_subsets(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have a google-style doc-string as the rest of the functions in the library. This is so pdoc can automatically generate documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants