text stringlengths 81 112k |
|---|
All graphic tags and some associated data about the related component doi
and the parent of that doi (not always present), and whether it is
part of a figure supplement
def graphics(soup):
"""
All graphic tags and some associated data about the related component doi
and the parent of that doi (not ... |
inline-graphic tags
def inline_graphics(soup):
"""
inline-graphic tags
"""
inline_graphics = []
inline_graphic_tags = raw_parser.inline_graphic(soup)
position = 1
for tag in inline_graphic_tags:
item = {}
copy_attribute(tag.attrs, 'xlink:href', item, 'xlink_href')
... |
self-uri tags
def self_uri(soup):
"""
self-uri tags
"""
self_uri = []
self_uri_tags = raw_parser.self_uri(soup)
position = 1
for tag in self_uri_tags:
item = {}
copy_attribute(tag.attrs, 'xlink:href', item, 'xlink_href')
copy_attribute(tag.attrs, 'content-type', it... |
supplementary-material tags
def supplementary_material(soup):
"""
supplementary-material tags
"""
supplementary_material = []
supplementary_material_tags = raw_parser.supplementary_material(soup)
position = 1
for tag in supplementary_material_tags:
item = {}
copy_attribu... |
Given a contrib tag, look for an email tag, and
only return the value if it is not inside an aff tag
def contrib_email(contrib_tag):
"""
Given a contrib tag, look for an email tag, and
only return the value if it is not inside an aff tag
"""
email = []
for email_tag in extract_nodes(contrib... |
Given a contrib tag, look for an phone tag
def contrib_phone(contrib_tag):
"""
Given a contrib tag, look for an phone tag
"""
phone = None
if raw_parser.phone(contrib_tag):
phone = first(raw_parser.phone(contrib_tag)).text
return phone |
Given a contrib tag, look for an aff tag directly inside it
def contrib_inline_aff(contrib_tag):
"""
Given a contrib tag, look for an aff tag directly inside it
"""
aff_tags = []
for child_tag in contrib_tag:
if child_tag and child_tag.name and child_tag.name == "aff":
aff_tags.... |
Given a contrib tag, look for an xref tag of type ref_type directly inside the contrib tag
def contrib_xref(contrib_tag, ref_type):
"""
Given a contrib tag, look for an xref tag of type ref_type directly inside the contrib tag
"""
aff_tags = []
for child_tag in contrib_tag:
if (child_tag an... |
find all contributors not contrained to only the ones in article meta
def all_contributors(soup, detail="brief"):
"find all contributors not contrained to only the ones in article meta"
contrib_tags = raw_parser.contributors(soup)
contributors = format_authors(soup, contrib_tags, detail)
return contrib... |
Non-byline authors for group author members
def authors_non_byline(soup, detail="full"):
"""Non-byline authors for group author members"""
# Get a filtered list of contributors, in order to get their group-author-id
contrib_type = "author non-byline"
contributors_ = contributors(soup, detail)
non_b... |
Find and return all the references
def refs(soup):
"""Find and return all the references"""
tags = raw_parser.ref_list(soup)
refs = []
position = 1
article_doi = doi(soup)
for tag in tags:
ref = {}
ref['ref'] = ref_text(tag)
# ref_id
copy_attribute(tag.attrs,... |
Used to get component DOI from a tag and confirm it is actually for that tag
and it is not for one of its children in the list of nodenames
def extract_component_doi(tag, nodenames):
"""
Used to get component DOI from a tag and confirm it is actually for that tag
and it is not for one of its children i... |
Find the components, i.e. those parts that would be assigned
a unique component DOI, such as figures, tables, etc.
- position is in what order the tag appears in the entire set of nodes
- ordinal is in what order it is for all the tags of its own type
def components(soup):
"""
Find the components, ... |
Find the corresp tags included in author-notes
for primary correspondence
def correspondence(soup):
"""
Find the corresp tags included in author-notes
for primary correspondence
"""
correspondence = []
author_notes_nodes = raw_parser.author_notes(soup)
if author_notes_nodes:
c... |
Find the fn tags included in author-notes
def author_notes(soup):
"""
Find the fn tags included in author-notes
"""
author_notes = []
author_notes_section = raw_parser.author_notes(soup)
if author_notes_section:
fn_nodes = raw_parser.fn(author_notes_section)
for tag in fn_nodes... |
Find the fn tags included in author-notes
def full_author_notes(soup, fntype_filter=None):
"""
Find the fn tags included in author-notes
"""
notes = []
author_notes_section = raw_parser.author_notes(soup)
if author_notes_section:
fn_nodes = raw_parser.fn(author_notes_section)
n... |
Find the fn tags included in the competing interest
def competing_interests(soup, fntype_filter):
"""
Find the fn tags included in the competing interest
"""
competing_interests_section = extract_nodes(soup, "fn-group", attr="content-type", value="competing-interest")
if not competing_interests_se... |
Find the fn tags included in the competing interest
def author_contributions(soup, fntype_filter):
"""
Find the fn tags included in the competing interest
"""
author_contributions_section = extract_nodes(soup, "fn-group", attr="content-type", value="author-contribution")
if not author_contribution... |
Find the award-group items and return a list of details
def full_award_groups(soup):
"""
Find the award-group items and return a list of details
"""
award_groups = []
funding_group_section = extract_nodes(soup, "funding-group")
# counter for auto generated id values, if required
generated_... |
Find the award-group items and return a list of details
def award_groups(soup):
"""
Find the award-group items and return a list of details
"""
award_groups = []
funding_group_section = extract_nodes(soup, "funding-group")
for fg in funding_group_section:
award_group_tags = extract_no... |
Given a funding group element
Find the award group funding sources, one for each
item found in the get_funding_group section
def award_group_funding_source(tag):
"""
Given a funding group element
Find the award group funding sources, one for each
item found in the get_funding_group section
... |
Given a funding group element
Find the award group funding sources, one for each
item found in the get_funding_group section
def full_award_group_funding_source(tag):
"""
Given a funding group element
Find the award group funding sources, one for each
item found in the get_funding_group section... |
Find the award group award id, one for each
item found in the get_funding_group section
def award_group_award_id(tag):
"""
Find the award group award id, one for each
item found in the get_funding_group section
"""
award_group_award_id = []
award_id_tags = extract_nodes(tag, "award-id")
... |
Find the award group principal award recipient, one for each
item found in the get_funding_group section
def award_group_principal_award_recipient(tag):
"""
Find the award group principal award recipient, one for each
item found in the get_funding_group section
"""
award_group_principal_award_r... |
DOI in an object-id tag found inside the tag
def object_id_doi(tag, parent_tag_name=None):
"""DOI in an object-id tag found inside the tag"""
doi = None
object_id = None
object_ids = raw_parser.object_id(tag, "doi")
if object_ids:
object_id = first([id_ for id_ in object_ids])
if parent... |
Extract the title tag and sometimes inspect its parents
def title_tag_inspected(tag, parent_tag_name=None, p_parent_tag_name=None, direct_sibling_only=False):
"""Extract the title tag and sometimes inspect its parents"""
title_tag = None
if direct_sibling_only is True:
for sibling_tag in tag:
... |
Extract the text of a title tag and sometimes inspect its parents
def title_text(tag, parent_tag_name=None, p_parent_tag_name=None, direct_sibling_only=False):
"""Extract the text of a title tag and sometimes inspect its parents"""
title = None
title_tag = title_tag_inspected(tag, parent_tag_name, p_paren... |
covert boxed-text to an image block containing an inline-graphic
def boxed_text_to_image_block(tag):
"covert boxed-text to an image block containing an inline-graphic"
tag_block = OrderedDict()
image_content = body_block_image_content(first(raw_parser.inline_graphic(tag)))
tag_block["type"] = "image"
... |
Get body json and then alter it with section wrapping and removing boxed-text
def body_json(soup, base_url=None):
""" Get body json and then alter it with section wrapping and removing boxed-text """
body_content = body(soup, remove_key_info_box=True, base_url=base_url)
# Wrap in a section if the first blo... |
Render the tag as body content and call recursively if
the tag has child tags
def body_block_content_render(tag, recursive=False, base_url=None):
"""
Render the tag as body content and call recursively if
the tag has child tags
"""
block_content_list = []
tag_content = OrderedDict()
if... |
paragraphs may wrap some other body block content
this is separated out so it can be called from more than one place
def body_block_paragraph_render(p_tag, html_flag=True, base_url=None):
"""
paragraphs may wrap some other body block content
this is separated out so it can be called from more than one ... |
fig and media tag captions are similar so use this common function
def body_block_caption_render(caption_tags, base_url=None):
"""fig and media tag captions are similar so use this common function"""
caption_content = []
supplementary_material_tags = []
for block_tag in remove_doi_paragraph(caption_ta... |
fig and media tag caption may have supplementary material
def body_block_supplementary_material_render(supp_tags, base_url=None):
"""fig and media tag caption may have supplementary material"""
source_data = []
for supp_tag in supp_tags:
for block_content in body_block_content_render(supp_tag, base... |
for formatting of simple paragraphs of text only, and check if it is all whitespace
def body_block_paragraph_content(text):
"for formatting of simple paragraphs of text only, and check if it is all whitespace"
tag_content = OrderedDict()
if text and text != '':
tag_content["type"] = "paragraph"
... |
format a graphic or inline-graphic into a body block json format
def body_block_image_content(tag):
"format a graphic or inline-graphic into a body block json format"
image_content = OrderedDict()
if tag:
copy_attribute(tag.attrs, 'xlink:href', image_content, 'uri')
if "uri" in image_conten... |
set the title, label and caption values in a consistent way
set_caption: insert a "caption" field
prefer_title: when only one value is available, set title rather than label. If False, set label rather than title
def body_block_title_label_caption(tag_content, title_value, label_value,
... |
extract the attribution content for figures, tables, videos
def body_block_attribution(tag):
"extract the attribution content for figures, tables, videos"
attributions = []
if raw_parser.attrib(tag):
for attrib_tag in raw_parser.attrib(tag):
attributions.append(node_contents_str(attrib_... |
Note: for some reason this works and few other attempted methods work
Search for certain node types, find the first nodes siblings of the same type
Add the first sibling and the other siblings to a list and return them
def body_blocks(soup):
"""
Note: for some reason this works and few other attempted ... |
abstract in article json format
def abstract_json(soup):
"""abstract in article json format"""
abstract_tags = raw_parser.abstract(soup)
abstract_json = None
for tag in abstract_tags:
if tag.get("abstract-type") is None:
abstract_json = render_abstract_json(tag)
return abstract_... |
digest in article json format
def digest_json(soup):
"""digest in article json format"""
abstract_tags = raw_parser.abstract(soup, abstract_type="executive-summary")
abstract_json = None
for tag in abstract_tags:
abstract_json = render_abstract_json(tag)
return abstract_json |
compile author affiliations for json output
def author_affiliations(author, html_flag=True):
"""compile author affiliations for json output"""
# Configure the XML to HTML conversion preference for shorthand use below
convert = lambda xml_string: xml_to_html(html_flag, xml_string)
affilations = []
... |
add more author json
def author_json_details(author, author_json, contributions, correspondence,
competing_interests, equal_contributions_map, present_address_data,
foot_notes_data, html_flag=True):
# Configure the XML to HTML conversion preference for shorthand use ... |
compile a map of author collab to group-author-key
def collab_to_group_author_key_map(authors):
"""compile a map of author collab to group-author-key"""
collab_map = {}
for author in authors:
if author.get("collab"):
collab_map[author.get("collab")] = author.get("group-author-key")
... |
assign numeric values to each unique equal-contrib id
def map_equal_contributions(contributors):
"""assign numeric values to each unique equal-contrib id"""
equal_contribution_map = {}
equal_contribution_keys = []
for contributor in contributors:
if contributor.get("references") and "equal-cont... |
authors list in article json format
def authors_json(soup):
"""authors list in article json format"""
authors_json_data = []
contributors_data = contributors(soup, "full")
author_contributions_data = author_contributions(soup, None)
author_competing_interests_data = competing_interests(soup, None)
... |
take preferred names from authors json and format them into an author line
def author_line(soup):
"""take preferred names from authors json and format them into an author line"""
author_line = None
authors_json_data = authors_json(soup)
author_names = extract_author_line_names(authors_json_data)
if... |
authorLine format depends on if there is 1, 2 or more than 2 authors
def format_author_line(author_names):
"""authorLine format depends on if there is 1, 2 or more than 2 authors"""
author_line = None
if not author_names:
return author_line
if len(author_names) <= 2:
author_line = ", ".... |
Handle year value parsing for some edge cases
def references_date(year=None):
"Handle year value parsing for some edge cases"
date = None
discriminator = None
in_press = None
if year and "in press" in year.lower().strip():
in_press = True
elif year and re.match("^[0-9]+$", year):
... |
build the authors for references json here for testability
def references_json_authors(ref_authors, ref_content):
"build the authors for references json here for testability"
all_authors = references_authors(ref_authors)
if all_authors != {}:
if ref_content.get("type") in ["conference-proceeding", ... |
Check for references that will not pass schema validation, fix or convert them to unknown
def convert_references_json(ref_content, soup=None):
"Check for references that will not pass schema validation, fix or convert them to unknown"
# Convert reference to unkonwn if still missing important values
if (
... |
Extract detail value for references of type unknown
def references_json_unknown_details(ref_content, soup=None):
"Extract detail value for references of type unknown"
details = ""
# Try adding pages values first
if "pages" in ref_content:
if "range" in ref_content["pages"]:
details... |
for use in removing unwanted boxed-content from appendices json
def unwrap_appendix_box(json_content):
"""for use in removing unwanted boxed-content from appendices json"""
if json_content.get("content") and len(json_content["content"]) > 0:
first_block = json_content["content"][0]
if (first_bl... |
Extract schemas from 'source_path'.
:returns: a list of ViewSchema objects on success, None if no schemas
could be extracted.
def extract_schemas_from_file(source_path):
"""Extract schemas from 'source_path'.
:returns: a list of ViewSchema objects on success, None if no schemas
could be e... |
Get simple assignments from node tree.
def _get_simple_assignments(tree):
"""Get simple assignments from node tree."""
result = {}
for node in ast.walk(tree):
if isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name):
... |
Extract schemas from 'source'.
The 'source' parameter must be a string, and should be valid python
source.
If 'source' is not valid python source, a SyntaxError will be raised.
:returns: a list of ViewSchema objects.
def extract_schemas_from_source(source, filename='<unknown>'):
"""Extract schem... |
Render a value, ensuring that any nested dicts are sorted by key.
def render_value(value):
"""Render a value, ensuring that any nested dicts are sorted by key."""
if isinstance(value, list):
return '[' + ', '.join(render_value(v) for v in value) + ']'
elif isinstance(value, dict):
return (
... |
Render syntactically valid python service double code.
def write_service_double_file(target_root, service_name, rendered):
"""Render syntactically valid python service double code."""
target_path = os.path.join(
target_root,
'snapstore_schemas', 'service_doubles', '%s.py' % service_name
)
... |
Dedent docstring, special casing the first line.
def clean_docstring(docstring):
"""Dedent docstring, special casing the first line."""
docstring = docstring.strip()
if '\n' in docstring:
# multiline docstring
if docstring[0].isspace():
# whole docstring is indented
... |
Recursively sorts a JSON schema by dict key.
def _sort_schema(schema):
"""Recursively sorts a JSON schema by dict key."""
if isinstance(schema, dict):
for k, v in sorted(schema.items()):
if isinstance(v, dict):
yield k, OrderedDict(_sort_schema(v))
elif isinstan... |
Recursively build a map of (group, name) => url patterns.
Group is either the resolver namespace or app name for the url config.
The urls are joined with any prefixes, and cleaned up of extraneous regex
specific syntax.
def urlmap(patterns):
"""Recursively build a map of (group, name) => url patterns... |
Returns a JSON Schema representation of a form field.
def get_field_schema(name, field):
"""Returns a JSON Schema representation of a form field."""
field_schema = {
'type': 'string',
}
if field.label:
field_schema['title'] = str(field.label) # force translation
if field.help_tex... |
Return a JSON Schema object for a Django Form.
def get_form_schema(form):
"""Return a JSON Schema object for a Django Form."""
schema = {
'type': 'object',
'properties': {},
}
for name, field in form.base_fields.items():
schema['properties'][name] = get_field_schema(name, field... |
Link to an API handler class (e.g. piston or DRF).
def handler(self, handler_class):
"""Link to an API handler class (e.g. piston or DRF)."""
self.handler_class = handler_class
# we take the docstring from the handler class, not the methods
if self.docs is None and handler_class.__doc__... |
For formatting json output into HTML friendly format
def xml_to_html(html_flag, xml_string, base_url=None):
"For formatting json output into HTML friendly format"
if not xml_string or not html_flag is True:
return xml_string
html_string = xml_string
html_string = remove_comment_tags(html_string... |
Replace tags such as <italic> to <i>
This does not validate markup
def replace_simple_tags(s, from_tag='italic', to_tag='i', to_open_tag=None):
"""
Replace tags such as <italic> to <i>
This does not validate markup
"""
if to_open_tag:
s = s.replace('<' + from_tag + '>', to_open_tag)
... |
Validate the body of incoming requests for a flask view.
An example usage might look like this::
from snapstore_schemas import validate_body
@validate_body({
'type': 'array',
'items': {
'type': 'object',
'properties': {
... |
Support extracting the schema from the decorated function.
def record_schemas(
fn, wrapper, location, request_schema=None, response_schema=None):
"""Support extracting the schema from the decorated function."""
# have we already been decorated by an acceptable api call?
has_acceptable = hasattr(fn,... |
Validate the body of a response from a flask view.
Like `validate_body`, this function compares a json document to a
jsonschema specification. However, this function applies the schema to the
view response.
Instead of the view returning a flask response object, it should instead
return a Python li... |
Validate `payload` against `schema`, returning an error list.
jsonschema provides lots of information in it's errors, but it can be a bit
of work to extract all the information.
def validate(payload, schema):
"""Validate `payload` against `schema`, returning an error list.
jsonschema provides lots of... |
Connects to a Phoenix query server.
:param url:
URL to the Phoenix query server, e.g. ``http://localhost:8765/``
:param autocommit:
Switch the connection to autocommit mode.
:param readonly:
Switch the connection to readonly mode.
:param max_retries:
The maximum numbe... |
Opens a HTTP connection to the RPC server.
def connect(self):
"""Opens a HTTP connection to the RPC server."""
logger.debug("Opening connection to %s:%s", self.url.hostname, self.url.port)
try:
self.connection = httplib.HTTPConnection(self.url.hostname, self.url.port)
se... |
Closes the HTTP connection to the RPC server.
def close(self):
"""Closes the HTTP connection to the RPC server."""
if self.connection is not None:
logger.debug("Closing connection to %s:%s", self.url.hostname, self.url.port)
try:
self.connection.close()
... |
Synchronizes connection properties with the server.
:param connection_id:
ID of the current connection.
:param connProps:
Dictionary with the properties that should be changed.
:returns:
A ``common_pb2.ConnectionProperties`` object.
def connection_sync(sel... |
Opens a new connection.
:param connection_id:
ID of the connection to open.
def open_connection(self, connection_id, info=None):
"""Opens a new connection.
:param connection_id:
ID of the connection to open.
"""
request = requests_pb2.OpenConnectionRequ... |
Closes a connection.
:param connection_id:
ID of the connection to close.
def close_connection(self, connection_id):
"""Closes a connection.
:param connection_id:
ID of the connection to close.
"""
request = requests_pb2.CloseConnectionRequest()
... |
Creates a new statement.
:param connection_id:
ID of the current connection.
:returns:
New statement ID.
def create_statement(self, connection_id):
"""Creates a new statement.
:param connection_id:
ID of the current connection.
:returns:
... |
Closes a statement.
:param connection_id:
ID of the current connection.
:param statement_id:
ID of the statement to close.
def close_statement(self, connection_id, statement_id):
"""Closes a statement.
:param connection_id:
ID of the current connec... |
Prepares and immediately executes a statement.
:param connection_id:
ID of the current connection.
:param statement_id:
ID of the statement to prepare.
:param sql:
SQL query.
:param max_rows_total:
The maximum number of rows that will b... |
Prepares a statement.
:param connection_id:
ID of the current connection.
:param sql:
SQL query.
:param max_rows_total:
The maximum number of rows that will be allowed for this query.
:returns:
Signature of the prepared statement.
def ... |
Returns a frame of rows.
The frame describes whether there may be another frame. If there is not
another frame, the current iteration is done when we have finished the
rows in the this frame.
:param connection_id:
ID of the current connection.
:param statement_id:
... |
Returns a frame of rows.
The frame describes whether there may be another frame. If there is not
another frame, the current iteration is done when we have finished the
rows in the this frame.
:param connection_id:
ID of the current connection.
:param statement_id:
... |
Closes the cursor.
No further operations are allowed once the cursor is closed.
If the cursor is used in a ``with`` statement, this method will
be automatically called at the end of the ``with`` block.
def close(self):
"""Closes the cursor.
No further operations are allowed onc... |
Transforms a Row into Python values.
:param row:
A ``common_pb2.Row`` object.
:returns:
A list of values casted into the correct Python types.
:raises:
NotImplementedError
def _transform_row(self, row):
"""Transforms a Row into Python values.
... |
Read-only attribute providing the current 0-based index of the
cursor in the result set or ``None`` if the index cannot be
determined.
The index can be seen as index of the cursor in a sequence
(the result set). The next fetch operation will fetch the
row indexed by :attr:`rownu... |
Constructs an object holding a datetime/timestamp value.
def Timestamp(year, month, day, hour, minute, second):
"""Constructs an object holding a datetime/timestamp value."""
return datetime.datetime(year, month, day, hour, minute, second) |
Opens the connection.
def open(self):
"""Opens the connection."""
self._id = str(uuid.uuid4())
self._client.open_connection(self._id, info=self._connection_args) |
Closes the connection.
No further operations are allowed, either on the connection or any
of its cursors, once the connection is closed.
If the connection is used in a ``with`` statement, this method will
be automatically called at the end of the ``with`` block.
def close(self):
... |
Creates a new cursor.
:param cursor_factory:
This argument can be used to create non-standard cursors.
The class returned must be a subclass of
:class:`~phoenixdb.cursor.Cursor` (for example :class:`~phoenixdb.cursor.DictCursor`).
A default factory for the connec... |
Sets one or more parameters in the current connection.
:param autocommit:
Switch the connection to autocommit mode. With the current
version, you need to always enable this, because
:meth:`commit` is not implemented.
:param readonly:
Switch the connectio... |
Fit the model
Parameters
----------
X : array-like of shape = [n_samples, n_features]
The training input samples.
y : array-like, shape = [n_samples]
The target values
Returns
-------
self : object
Returns self.
def fit(self... |
Predict target values for X.
Parameters
----------
X : array-like of shape = [n_samples, n_features]
The input samples.
Returns
-------
y : array of shape = [n_samples]
The predicted target value.
def predict(self, X):
"""Predict target ... |
Compute hidden activations given X
def _compute_hidden_activations(self, X):
"""Compute hidden activations given X"""
self._compute_input_activations(X)
acts = self.input_activations_
if (callable(self.activation_func)):
args_dict = self.activation_args if (self.activatio... |
Generate the random hidden layer's activations given X as input.
Parameters
----------
X : {array-like, sparse matrix}, shape [n_samples, n_features]
Data to transform
y : is not used: placeholder to allow for usage in a Pipeline.
Returns
-------
X_... |
Generate RBF radii
def _compute_radii(self):
"""Generate RBF radii"""
# use supplied radii if present
radii = self._get_user_components('radii')
# compute radii
if (radii is None):
centers = self.components_['centers']
n_centers = centers.shape[0]
... |
Generate RBF centers
def _compute_centers(self, X, sparse, rs):
"""Generate RBF centers"""
# use supplied centers if present
centers = self._get_user_components('centers')
# use points taken uniformly from the bounding
# hyperrectangle
if (centers is None):
... |
Generate MLP biases
def _compute_biases(self, rs):
"""Generate MLP biases"""
# use supplied biases if present
biases = self._get_user_components('biases')
if (biases is None):
b_size = self.n_hidden
biases = rs.normal(size=b_size)
self.components_['bias... |
Generate MLP weights
def _compute_weights(self, X, rs):
"""Generate MLP weights"""
# use supplied weights if present
weights = self._get_user_components('weights')
if (weights is None):
n_features = X.shape[1]
hw_size = (n_features, self.n_hidden)
we... |
Generate components of hidden layer given X
def _generate_components(self, X):
"""Generate components of hidden layer given X"""
rs = check_random_state(self.random_state)
if (self._use_mlp_input):
self._compute_biases(rs)
self._compute_weights(X, rs)
if (self.... |
Compute input activations given X
def _compute_input_activations(self, X):
"""Compute input activations given X"""
n_samples = X.shape[0]
mlp_acts = np.zeros((n_samples, self.n_hidden))
if (self._use_mlp_input):
b = self.components_['biases']
w = self.component... |
Generate centers, then compute tau, dF and dN vals
def _compute_centers(self, X, sparse, rs):
"""Generate centers, then compute tau, dF and dN vals"""
super(GRBFRandomLayer, self)._compute_centers(X, sparse, rs)
centers = self.components_['centers']
sorted_distances = np.sort(squarefo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.