Social networking analysis - social-networking

Do you know How to code Link Prediction in DiGraph Network?
d=nx.preferential_attachment(G1)
d.sort(key=operator.itemgetter(2), reverse = True)
print('preferential_attachment_G1: {}'.format(d))
error: not implemented for directed type

Related

Configure subnetwork for vertex ai pipeline component

I have a vertex ai pipeline component that needs to connect to a database. This database exists in a VPC network. Currently my component is failing because it is not able to connect to the database, but I believe I can get it to work if I can configure the component to use the subnetwork.
How do I configure the workerPoolSpecs of the component to use the subnetwork?
I was hoping I could do something like that:
preprocess_data_op = component_store.load_component('org/ml_engine/preprocess')
#dsl.pipeline(name="test-pipeline-vertex-ai")
def pipeline(project_id: str, some_param: str):
preprocess_data_op(
project_id=project_id,
my_param=some_param,
subnetwork_uri="projects/xxxxxxxxx/global/networks/data",
).set_display_name("Preprocess data")
However the param is not there, and i get
TypeError: Preprocess() got an unexpected keyword argument 'subnetwork_uri'
How do I define the subnetwork for the component?
From Google docs, There is no mention of how you can run a specific component on a subnetwork.
However, it is possible to run the entire pipeline in a subnetwork by passing in the subnetwork as part of the job submit api.
job.submit(service_account=SERVICE_ACCOUNT, network=NETWORK)

Do AutoMl predictions not work when uploaded into Google Cloud Functions

Im writing code that makes a prediction based on a trained AutoMl multi-label Classifier. The function works if I run it locally, however, as soon as i upload the same code to Cloud Functions on GCP (a process that i know usually works) it provides me with this error
TypeError: predict() takes from 1 to 2 positional arguments but 4 were given
Here is a sample of my code, taken straight from the AutoMl documentation with some slight adjustments.
def get_sentiment(content):
"""
Returns a google cloud platform payload class containing the sentiment score given by our NLP sentiment analyser.
:param content: STRING (UTF-8 encoded, ASCII)
:return: <class 'google.cloud.automl.types.PredictResponse'>
"""
options = ClientOptions(api_endpoint='automl.googleapis.com')
prediction_client = automl_v1beta1.PredictionServiceClient(client_options=options)
name = model_sentiment
payload = {'text_snippet': {'content': content, 'mime_type': 'text/plain'}}
params = {}
request = prediction_client.predict(name, payload, params)
return request
I have tried removing the params variable from prediction and replacing payload with content the only change is that I get the error:
TypeError: predict() takes from 1 to 2 positional arguments but 3 were given
Additionally, I have replaced automl_v1beta1 with automl and automl_v1. and again while both work locally they do not work on Google Cloud.
Thank you for any advice or help
Update, Apparently there are some bugs in the latest version of AutoML and the error was fixed by running the code on a previous version of it. Specifically in my case v0.9.0

How to add more RSU node on Veins

I'm facing some problem when trying to add more RSU node on veins example code.
Here's the code I added in RSUExampleScenario.ned
rsu[2]: RSU {
#display("p=162,140;i=veins/sign/yellowdiamond;is=vs");
}
And more codes in .ini
*.rsu[1].mobility.x = 1800
*.rsu[1].mobility.y = 1800
*.rsu[1].mobility.z = 2
When I try to start the simulation,error message says
Error: Name 'rsu' is not unique within its component
I'd really appreciate with some help to solve this problem
The example is a bit confusing here. You should not add this code, but rather replace rsu[1] with rsu[n], where n is the amount of nodes you want. You can then specify the location of each in the omnetpp.ini as you're doing here. Check out this part of the OMNeT++ tutorial for more details. This has the following example:
network Tictoc10
{
submodules:
tic[6]: Txc10;
Here we created 6 modules as a module vector...

How can I get mobile node IP address in OPNET 14.5?

I tried the following code in OPNET Modeler 14.5
Objid addr_info_attr_objid;
char address_string[128];
addr_info_attr_objid = op_id_self();
op_ima_obj_attr_get(addr_info_attr_objid, "Address", address_string);
to get the node IP Address but it gives this error message:
<<<Recoverable Error>>>
Attribute name(Address) is unrecognizzed for object(542)
You have to find the proper IP interface First.
Based on your code, it is not right way to get IP address of one-interface node, such as Server/Client model.
Here is sample code
op_ima_obj_attr_get(ip_moudle_objid, "IP Router Parameters [0].Interface Information [3].Address", &address_str);

Adding Edge Label Titan-Rexster

I am imlpementing the Titan graph database with Rexster and Cassandra.
I try to add an edge like this in Ruby with Gremlin:
query = 'a = g.addVertex(null,[name:\'' +
someName +
'\']); g.addEdge(null, g.getVertex(' +
someVertexId + '), a, \'labelname\', [weight:' +
someFloatValue.round(5) + 'd]); g.commit();'
#This formats to the following:
#"a = g.addVertex(null,[name:'myawesomename']); g.addEdge(null, g.getVertex(1337), a, 'labelname', [weight:0.30685d]); g.commit();"
After running this I get the following error:
#<Rexster::Rest::RexsterError: Graph server returned error: javax.script.ScriptException: java.lang.IllegalArgumentException: The type of given name is not a label: labelname>
It seems like I have not defined the label with the name labelname, I got that. However, I can not for the life of me figure out how to add this label so I am able to add this edge to the graph.
Adding vertices works fine by the way.
I am using the rexster_ruby gem which connects to a ubuntu 12.04 machine with titan-server 0.4.0 running the titan.sh script.
The Titan TypeMaker has seen some serious API changes going from 0.3.x to 0.4.x. You can read about how to define an edge label here:
https://github.com/thinkaurelius/titan/wiki/Type-Definition-Overview#creating-edge-labels
It is is recommended that you use the TypeMaker at initialization of your graph, preferably outside of libraries like rexster_ruby, REST, etc. Simply initialize your graph from the Gremlin REPL. Even better, encapsulate those type definitions in a groovy class to maintain your schema.

Resources