AssertionError after trying to convert .sbml file to ode using sbmltoodepy - python

I am trying to run a simple example using sbmltoodepy and I am receiving the following error.
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\JetBrains\PyCharm2021.2\scratches\scratch_79.py", line 8, in
ParseAndCreateModel(inputFilePath)#, jsonFilePath=None, outputFilePath=None)#, className="SBMLmodel")
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\sbmltoodepy\utilities.py", line 66, in ParseAndCreateModel
modelData = ParseSBMLFile(inputFilePath)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\sbmltoodepy\parse.py", line 284, in ParseSBMLFile
assert(doc.getNumErrors() == 0)
AssertionError
Here is the code that I used.
import sbmltoodepy
from sbmltoodepy import ParseAndCreateModel
inputFilePath = "E:/Borisov2009_insulin_EGF.xml"
ParseAndCreateModel(inputFilePath, jsonFilePath=None, outputFilePath=None, className="SBMLmodel")
model = sbmltoodepy.SBMLmodel()
model.RunSimulation(1, absoluteTolerance = 1e-12, relativeTolerance = 1e-6)
Thank you in advance for your time.

Related

KeyError: 0 in weighted deepWalk python

With running the weighted deppWalk implementation I faced with below error. I edit the source code based on issue1 and issu2 and issue3; but, problem still exist. How can I solve that? Is there any other library for weighted deepWalk in python?
Traceback (most recent call last):
File "/usr/local/bin/deepwalk", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/deepwalk/__main__.py", line 145, in main
process(args)
File "/usr/local/lib/python3.7/dist-packages/deepwalk/__main__.py", line 73, in process
walks = weighted_random_walk.random_walk(G, num_paths=args.number_walks,path_length=args.walk_length, alpha=0)
File "/usr/local/lib/python3.7/dist-packages/deepwalk/weighted_random_walk.py", line 45, in random_walk
sentence = [nodes[tmp] for tmp in indexList]
File "/usr/local/lib/python3.7/dist-packages/deepwalk/weighted_random_walk.py", line 45, in <listcomp>
sentence = [nodes[tmp] for tmp in indexList]
File "/usr/local/lib/python3.7/dist-packages/networkx/classes/reportviews.py", line 193, in __getitem__
return self._nodes[n]
KeyError: 0

mcpi-e. error when getting coordinates. mc.player.getPos()

Code:
from mcpi_e.minecraft import Minecraft
mc = Minecraft.create('127.0.0.1', 4711)
pos = mc.player.getPos()
When trying to get coordinates.
mc.player.getPos()
an error pops up
Error:
Traceback (most recent call last):
File "C:\Users\merka\Desktop\pyt minecraft\buy.py", line 23, in <module>
pos = mc.player.getPos()
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\minecraft.py", line 230, in getPos
return CmdPositioner.getPos(self, self.playerId)
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\minecraft.py", line 50, in getPos
s = self.conn.sendReceive(self.pkg + b".getPos", id)
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\connection.py", line 103, in sendReceive
return self.receive()
File "C:\Users\merka\AppData\Local\Programs\Python\Python39\lib\site-packages\mcpi_e\connection.py", line 97, in receive
raise RequestError("%s failed"%self.lastSent.strip())
mcpi_e.connection.RequestError: b'entity.getPos()' failed
Process finished with exit code 1
what can be done?
mc = Minecraft.create('127.0.0.1', 4711, "merka")
I should have added a nickname

A.t().mm(self.linear4.weight.t()) ->error: out of range at THTensor.cpp

While running the AutoEncoder model in PyTorch, I found a strange error.
My code:
model = AutoEncoder(num_items, args.inner_layers, num_items, da=args.num_attention, dropout_rate=args.dropout_rate)
item_vector = self.linear1.weight[:, T.LongTensor(batch_item_index[0].astype(np.int32))]
inner_product = item_vector.t().mm(self.linear4.weight.t())
I tried to make the index start from 0 after seeing the explanation that the cause of the batch index was -1 among little similar problems(https://github.com/jwyang/faster-rcnn.pytorch/issues/311), but it did not work.
This is the first time I haven't had a similar question on Stack Overflow, what am I doing wrong?
Traceback (most recent call last):
File "run.py", line 155, in <module>
main()
File "run.py", line 151, in main
train_autoencoder(train_matrix, test_set)
File "run.py", line 86, in train_autoencoder
y_pred = model(batch_item_index, place_correlation)
File "C:\Users\user\anaconda3\envs\saenad\lib\site-packages\torch\nn\modules\module.py", line 491, in __call__
result = self.forward(*input, **kwargs)
File "C:\Users\user\saenad\model.py", line 58, in forward
inner_product = item_vector.t().mm(self.linear4.weight.t())
RuntimeError: invalid argument 1: out of range at c:\programdata\miniconda3\conda-bld\pytorch_1524543037166\work\aten\src\th\generic/THTensor.cpp:454**
I found the item_vector is empty tensor([[]])!
So I added the code to handle an exception if item_vector.Size is 0 with below code.
if item_vector.shape == torch.Size([0]):
continue
<-- it works.
Hope this helps someone with the same error.:)

Wolfram Alpha Application Programming Interface Not Working

code:-
import wolframalpha
wolframappid = wolframalpha.Client("XXXXXX-XXXXXXXXXX")
res = wolframappid.query('temperature in mumbai')
answer = next(res.results).text
print(answer)
result:-
Traceback (most recent call last):
File "c:/Users/Harsh/Desktop/Harsh Python Projects/Test.py", line 5, in <module>
answer = next(res.results).text
File "C:\Users\Harsh\AppData\Roaming\Python\Python36\site-packages\wolframalpha\__init__.py", line 166, in text
return next(iter(self.subpod)).plaintext
ValueError: dictionary update sequence element #0 has length 1; 2 is required
any ideas how to solve this issue? i have also tried next(res.results).plaintext but another error pops up..
code:-
import wolframalpha
wolframappid = wolframalpha.Client("XXXXXX-XXXXXXXXXX")
res = wolframappid.query('temperature in mumbai')
answer = next(res.results).plaintext
print(answer)
result:-
Traceback (most recent call last):
File "C:\Users\Harsh\AppData\Roaming\Python\Python36\site-packages\wolframalpha\__init__.py", line 86, in __getattr__
val = self[name] if name in self else self[attr_name]
KeyError: '#plaintext'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/Harsh/Desktop/Harsh Python Projects/Test.py", line 5, in <module>
answer = next(res.results).plaintext
File "C:\Users\Harsh\AppData\Roaming\Python\Python36\site-packages\wolframalpha\__init__.py", line 88, in __getattr__
raise AttributeError(name)
AttributeError: plaintext
thanks in advance...

K means clustering using weka python

from weka.clusterers import Clusterer
import weka.core.converters as converters
data = converters.load_any_file("/home/ubuntu/test.csv")
data.class_is_last()
clusterer = Clusterer(classname="weka.clusterers.SimpleKMeans", options=["-N", "3"])
clusterer.build_clusterer(data)
print(clusterer)
# cluster the data
for inst in data:
cl = clusterer.cluster_instance(inst) # 0-based cluster index
dist = clusterer.distribution_for_instance(inst) # cluster membership distribution
print("cluster=" + str(cl) + ", distribution=" + str(dist))
I used the above code for doing k means custering i am not able to execute the program
The following are the errors I get
Traceback (most recent call last):
File "clus.py", line 6, in <module>
data = converters.load_any_file("/home/ubuntu/hello.csv")
File "/usr/local/lib/python2.7/dist-packages/weka/core/converters.py", line 255, in load_any_file
loader = loader_for_file(filename)
File "/usr/local/lib/python2.7/dist-packages/weka/core/converters.py", line 239, in loader_for_file
"(Ljava/lang/String;)Lweka/core/converters/AbstractFileLoader;", filename)
File "/usr/local/lib/python2.7/dist-packages/javabridge/jutil.py", line 932, in static_call
fn = make_static_call(class_name, method_name, sig)
File "/usr/local/lib/python2.7/dist-packages/javabridge/jutil.py", line 903, in make_static_call
klass = env.find_class(class_name)
AttributeError: 'NoneType' object has no attribute 'find_class'
I don't know why I am getting these errors. Can someone help me with this?
As described in the python-weka-wrapper API you have to import and start the Java Virtual Machine:
import weka.core.jvm as jvm
jvm.start()
It should solve your problem.

Categories