text stringlengths 0 93.6k |
|---|
return self |
def add_time_deltas(self): |
'''Adds time deltas (i.e. the time between subsequent transactions) to the edge features''' |
reverse_tds = True |
adj_list_in, adj_list_out = to_adj_edges_with_times(self) |
in_tds = time_deltas(self, adj_list_in) |
out_tds = [time_deltas(self, adj_list_out)] if reverse_tds else [] |
self.edge_attr = torch.cat([self.edge_attr, in_tds] + out_tds, dim=1) |
return self |
class HeteroGraphData(HeteroData): |
'''This is the heterogenous graph object we use for GNN training if reverse MP is enabled''' |
def __init__( |
self, |
readout: str = 'edge', |
**kwargs |
): |
super().__init__(**kwargs) |
self.readout = readout |
@property |
def num_nodes(self): |
return self['node'].x.shape[0] |
@property |
def timestamps(self): |
return self['node', 'to', 'node'].timestamps |
def add_ports(self): |
'''Adds port numberings to the edge features''' |
adj_list_in, adj_list_out = to_adj_nodes_with_times(self) |
in_ports = ports(self['node', 'to', 'node'].edge_index, adj_list_in) |
out_ports = ports(self['node', 'rev_to', 'node'].edge_index, adj_list_out) |
self['node', 'to', 'node'].edge_attr = torch.cat([self['node', 'to', 'node'].edge_attr, in_ports], dim=1) |
self['node', 'rev_to', 'node'].edge_attr = torch.cat([self['node', 'rev_to', 'node'].edge_attr, out_ports], dim=1) |
return self |
def add_time_deltas(self): |
'''Adds time deltas (i.e. the time between subsequent transactions) to the edge features''' |
adj_list_in, adj_list_out = to_adj_edges_with_times(self) |
in_tds = time_deltas(self, adj_list_in) |
out_tds = time_deltas(self, adj_list_out) |
self['node', 'to', 'node'].edge_attr = torch.cat([self['node', 'to', 'node'].edge_attr, in_tds], dim=1) |
self['node', 'rev_to', 'node'].edge_attr = torch.cat([self['node', 'rev_to', 'node'].edge_attr, out_tds], dim=1) |
return self |
def z_norm(data): |
std = data.std(0).unsqueeze(0) |
std = torch.where(std == 0, torch.tensor(1, dtype=torch.float32).cpu(), std) |
return (data - data.mean(0).unsqueeze(0)) / std |
def create_hetero_obj(x, y, edge_index, edge_attr, timestamps, args): |
'''Creates a heterogenous graph object for reverse message passing''' |
data = HeteroGraphData() |
data['node'].x = x |
data['node', 'to', 'node'].edge_index = edge_index |
data['node', 'rev_to', 'node'].edge_index = edge_index.flipud() |
data['node', 'to', 'node'].edge_attr = edge_attr |
data['node', 'rev_to', 'node'].edge_attr = edge_attr |
if args.ports: |
#swap the in- and outgoing port numberings for the reverse edges |
data['node', 'rev_to', 'node'].edge_attr[:, [-1, -2]] = data['node', 'rev_to', 'node'].edge_attr[:, [-2, -1]] |
data['node', 'to', 'node'].y = y |
data['node', 'to', 'node'].timestamps = timestamps |
return data |
# <FILESEP> |
"""AXL addLocation sample script, using the Zeep SOAP library |
Creates a new Device Pool, then creates a new Media Resource Group List and |
updates the Device Pool. |
Copyright (c) 2020 Cisco and/or its affiliates. |
Permission is hereby granted, free of charge, to any person obtaining a copy |
of this software and associated documentation files (the "Software"), to deal |
in the Software without restriction, including without limitation the rights |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
copies of the Software, and to permit persons to whom the Software is |
furnished to do so, subject to the following conditions: |
The above copyright notice and this permission notice shall be included in all |
copies or substantial portions of the Software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
SOFTWARE. |
""" |
from lxml import etree |
from requests import Session |
from requests.auth import HTTPBasicAuth |
from zeep import Client, Settings, Plugin, xsd |
from zeep.transports import Transport |
from zeep.exceptions import Fault |
import sys |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.