how to extract topical key phrases using mallet - machine-learning

I have imported the file in mallet, now I want to model topic from the imported data and store them in a text file, from where I will be able to read those topics. Can anyone help in writing the commands for topic extraction, as I typed command below for topic extraction but it throws exception.
bin\mallet import-dir --input D:\Data\test1 --output test1.mallet --keep-sequence --remove-stopwords --extra-stopwords extra.txt
by removing --keep-sequence --remove-stopwords --extra-stopwords extra.txt i am able to import file after that, when I try to train model exception is thrown.

I recommend you to use GUI for mallet.
https://code.google.com/p/topic-modeling-tool/

Related

How can I read pytorch model file via cv2.dnn.readNetFromTorch()?

I am able to save a PyTorch custom model? (it can work any PyTorch version above 1.0)
However, I am not able to read the saved model. I am trying to read it via cv2.dnn.readNetFromTorch() so as to use the model in Opencv framework (4.1.0).
I saved the PyTorch model with different methods as follows to see whether this difference reacts to the reading function of cv2.dnn.
torch.save(model.state_dict(), '/home/aktaseren/people-opencv/pidxx.pt')
torch.save(model.state_dict(), '/home/aktaseren/people-opencv/pidxx.t7')
torch.save(model, '/home/aktaseren/people-opencv/pidxx.t7')
torch.save(model, '/home/aktaseren/people-opencv/pidxx.pth')
None of these saved file can be readable via cv2.dnn.readNetFromTorch().
The error I am getting is always the same on this issue, which is below.
cv2.error: OpenCV(4.1.0) ../modules/dnn/src/torch/torch_importer.cpp:1022: error: (-213:The function/feature is not implemented) Unsupported Lua type in function 'readObject'
Do you have any idea how to solve this issue?
OpenCV documentation states can only read in torch7 framework format. There is no mention of .pt or .pth saved by pytorch.
This post mentions pytorch does not save as .t7.
.t7 was used in Torch7 and is not used in PyTorch. If I’m not mistaken
the file extension does not change the behavior of torch.save.
An alternate method is to export the model as onnx, then read the model in opencv using readNetFromONNX.
Yes, we have tested these methods (saving the model as .pt or .pth). And we couldn't load these model files by using opencv readNetFromTorch. We should use LibTorch or ONNX as the intermediate model file to be read from C++.

How to import InfluxDB tables into QuestDB?

I am trying to move data from InfluxDB to QuestDB,
I was able to export my tables as JSON by following: https://stackoverflow.com/a/27913640/1267728
How do I now import these JSON files into QuestDB?
Convert from JSON to CSV
QuestDB supports importing data via CSV file, so first you would need to flatten the JSON and ensure that column names are modified to reflect nested properties.
There is a Java library called Json2Flat that already does this.
Import the CSV file
Using the REST API, you can import the data into QuestDB
curl -F data=file.csv http://localhost:9000/imp
For more details of how to use the REST API, please go to the official documentation.
Check the data
To verify that the import is successful, you can check via the Web Console or via CURL…
curl -G --data-urlencode "query=select * from 'file.csv'" http://localhost:9000/exp
Just adding here that QuestDB recently improved the performance of CSV ingestion. More info at https://questdb.io/docs/guides/importing-data/
If you want to avoid converting from JSON (and probably more performant as well than exporting to JSON for large tables), you can use the influxd inspect export-lp command that exports all your data as ILP points. You can choose to export a single bucket.
Once you have the ILP files, you can import as explained at this other StackOverflow post What's the best way to upload an ILP file into QuestDB?

How do I convert .bin code property graph to json?

How can I convert a code property graph(cpg) obtained from joern (https://joern.io/) from .bin format to .json format for feeding it to a graph machine learning library for classification.
Note: CPG = AST + Control Flow Graph + Program Dependency Graph
Task: Machine Learning on Source Code.
You can use scala script 'graph-for-funcs.sc' which is included in the joern scripts directory. However you need to redirect the output in order to store it in file (since the output goes to stdout by default).
I made a custom script to do so.

Save tensorflow 2.0 model and use them in opencv 4

I currently code my models with tensorflow 2.0 and I want to run them with opencv 4 (I want to compare performance). But I can't find a way to convert my tensorflow model for opencv.
For running in opencv I want to use:
cv2.dnn.readNetFromTensorflow('saved_model.pb', 'saved_model.pbtxt')
but when I save my model with:
model.save('./')
I obtain this files:
saved_model.pb | variables/variables.index | variables/variables.data-00000-of-00002 |variables/variables.data-00001-of-00002
I have a my .pb but not my .pbtxt. How it is possible to write this file ? According to opencv documentation this file is the text graph definition. I already try to write a .pbtxt with
model.to_json()
but it didn't work :/
Do you have any ideas ?
Thanks in advance !
Tanguy
Additionally, OpenCV requires an extra configuration file based on the
.pb, the .pbtxt. It is possible to import your own models and
generate your own .pbtxt files by using one of the following files
from the OpenCV Github repository...
Here is a link to tutorial: https://jeanvitor.com/tensorflow-object-detecion-opencv/
Haven't tried it myself, but seems legit.
For example tf_text_graph_ssd.py does job done.

How to print out ASCII to a separate file.

I am trying to print data using
*EL PRINT
to a separate file other that jobname.dat file.
Is there any way to do this?
PS: I know how to export the data from the odb file.
Thanks
As far as I know you can't reroute that kind of input-file keyword output request to a different file. I've listed some alternatives below:
As you mention, you can script it using the Abaqus/Python API.
You can manually print results to a file of your choosing from the Viewer.
You can access the results file for postprocessing using a Fortran or C++ program (search for ABQMAIN).
You can access results and write them to a file of your choosing during the analysis using the Fortran subroutine URDFIL.

Resources