I am new to machine learning. When I tried learning through gate, it is showing some error. The learning configuration file is given below.
<?xml version="1.0"?>
<ML-CONFIG>
<SURROUND value="false"/>
<FILTERING ratio='0.2' dis='far'/>
<EVALUATION method="holdout" runs="2" ratio="0.66"/>
<multiClassification2Binary method="one-vs-anothers" thread-pool-size="2"/>
<PARAMETER name="thresholdProbabilityBoundary" value="1.0"/>
<PARAMETER name="thresholdProbabilityEntity" value="1.0"/>
<PARAMETER name="thresholdProbabilityClassification" value="0.0"/>
<IS-LABEL-UPDATABLE value="true"/>
<IS-NLPFEATURELIST-UPDATABLE value="true"/>
<ENGINE nickname="SVM" implementationName="SVMLibSvmJava" options = "-s 0 -t 1 -d 4 -c 5 -tau 1.2"/>
</ML-CONFIG>
Training attributes are inside this file. When I trained without the line containing multiclass xml tag it is working. when this line is added, an error is showing like below
Caused by: org.jdom.input.JDOMParseException: Error on line 6 of document file:/home/cognicor/vagateplugin/scripts/ML_script/learningsvm: Element type "multiClassi" must be followed by either attribute specifications, ">" or "/>".
I am not aware of this thing and why it happens and seek for a solution.
The problem is in the multiClassification2Binary string. There is a single glyph fi that contains two joined characters "fi" together. You probably copied the text from some pdf... Simply replace fi by fi and the error should go away.
Related
I have used this command in the terminal to publish /scan_new topic to the gmapping package in tb3_0 robot ROS_NAMESPACE=tb3_0 rosrun gmapping slam_gmapping scan:=scan_new set_base_frame:=tb3_0/base_footprint set_odom_frame:=tb3_0/odom set_map_frame:=tb3_0/map, but the gampping package is not subscribe to the /scan_new topic. What is the correct command to make sure that gmapping package of the tb3_0 robot is subscribe to the /scan_new topic?
*notes: As in the figure, red word is the ann_publisher node publish to the /scan_new and the gmapping package subscribe to /scan_new topic
This isn't working as expected because you're giving the node a namespace. When doing this, topic remaps that don't specify a namespace will default to the node's namespace. Here it's /tb3_0, meaning it's actually trying to subscribe to /tb3_0/scan_new. There are a few different ways to fix this, the first being that you can just specify the global namespace with a / like so: scan:=/scan_new . You can also do the same thing, but in a launch file:
<?xml version="1.0"?>
<launch>
<node ns="tb3_0" name="slam_gmapping" pkg="gmapping" type="slam_gmapping" output="screen">
<param name="base_frame" value="tb3_0/base_footprint" />
<param name="odom_frame" value="tb3_0/odom" />
<param name="map_frame" value="tb3_0/map" />
<remap from="scan" to="/scan_new" />
</node>
</launch>
I would highly suggest using the launch file method. It is much cleaner and will be much easier to expand as the number of nodes you want to run increase.
I want to extract an application version from a DITA map file. The ditamap file is valid and looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="user-manual">
<title><ph keyref="product"/> User Manual</title>
<topicmeta>
<prodinfo>
<prodname><keyword keyref="product"/></prodname>
<vrmlist>
<vrm version="4" release="3" modification="0"/>
</vrmlist>
</prodinfo>
</topicmeta>
<!--
[...]
-->
</map>
The information I want to get is in the <vrm> element.
"Easy peasy," I think to myself. So I use Ant's <xmlproperty> task to just load this XML file.
<project default="test">
<!-- notice #validate -->
<xmlproperty file="path/to/user-manual.ditamap" validate="false"/>
<target name="test">
<echo>${map.topicmeta.prodinfo.vrmlist.vrm(version)}</echo>
</target>
</project>
I don't want it to validate because Ant isn't going to find map.dtd.
Loading the file returns an error:
java.io.FileNotFoundException: /home/user/user-manual/map.dtd (No such file or directory)
If I remove the <!DOCTYPE> declaration or add a nested <xmlcatalog> with the path to the DTD, the file loads and I can use the properties from it.
I tested this with Ant 1.7.1 and 1.9.4. Is this a bug with Ant, or am I misunderstanding how Ant loads XML properties and the purpose of the validate attribute?
How can I make Ant obey my will?
I recommend to not use the <xmlproperty> for this. Please have a look at the docs:
For example, with semantic attribute processing enabled, this XML
property file:
<root>
<properties>
<foo location="bar"/>
<quux>${root.properties.foo}</quux>
</properties>
</root>
is roughly equivalent to the following fragments in a build.xml file:
<property name="root.properties.foo" location="bar"/>
<property name="root.properties.quux" value="${root.properties.foo}"/>
So the name of the properties you set is generated using their paths to the root element, so they rely on the structure of your DITA Map. But many elements in DITA may be set at different positions on your DITA Map. That means, if you move your metadata to another parent element, the property name changes and your build fails. This is probably not, what you want.
I'd recommend to grab those values via XSLT and than set the properties. That way, you could, for example, say, "give me the first occurance of that element with a simple //foo[1] XPath selector. Further on, you have the power of XSLT and XPath to slice values, format dates and so on before setting a property.
Update
You can use the oops consultancy Ant xmltask for that. It is very easy to set a property using <copy>:
<copy path="//critdates/created/#date"
property="document.date"
append="false"/>
I am new to machine learning. When I tried learning through gate, it is showing some error. The learning configuration file is given below.
<?xml version="1.0"?>
<ML-CONFIG>
<SURROUND value="false"/>
<FILTERING ratio='0.2' dis='far'/>
<EVALUATION method="holdout" runs="2" ratio="0.66"/>
<multiClassification2Binary method="one-vs-anothers" thread-pool-size="2"/>
<PARAMETER name="thresholdProbabilityBoundary" value="1.0"/>
<PARAMETER name="thresholdProbabilityEntity" value="1.0"/>
<PARAMETER name="thresholdProbabilityClassification" value="0.0"/>
<IS-LABEL-UPDATABLE value="true"/>
<IS-NLPFEATURELIST-UPDATABLE value="true"/>
<ENGINE nickname="SVM" implementationName="SVMLibSvmJava" options = "-s 0 -t 1 -d 4 -c 5 -tau 1.2"/>
</ML-CONFIG>
Training attributes are inside this file. When I trained without the line containing multiclass xml tag it is working. when this line is added, an error is showing like below
Caused by: org.jdom.input.JDOMParseException: Error on line 6 of document file:/home/cognicor/vagateplugin/scripts/ML_script/learningsvm: Element type "multiClassi" must be followed by either attribute specifications, ">" or "/>".
I am not aware of this thing and why it happens and seek for a solution.
I have thousands of properties in my property file and I want to change only one property like the following.
<propertyfile file="${mypropetyfile}">
<entry key="jndiname" value="java:comp/env/wm/default"/>
</propertyfile>
but in the property file I am getting the property value with an extra \:
jndiname=java\:comp/env/wm/default
I tried with the <echo> task but it removes other properties. I also tried by concatenation like following in this case also I am getting extra \
<propertyfile file="${mypropetyfile}">
<entry key="jndiname" default="" operation="+" value="java:comp/env/wm/default"/>
</propertyfile>
The \ before the : is an escape character. Although it's not necessary here because the : is not part of the key, but is part of the value, it doesn't hurt either. Using Properties.load() to load this properties file will unescape the :. You should not care about the escape.
Just ran into the same problem changing a property file read by Websphere 6.1 & ended up having to do this workaround:
<property name="jndi.example" value="java:comp/env/example" />
<propertyfile file="jdbc.properties">
<entry key="datasource.example.jndi" operation="=" value="#EXAMPLE"/>
</propertyfile>
<!-- set tokens to property values because ant wants to 'escape the colon' -->
<replace file="jdbc.properties" token="#EXAMPLE" value="${jndi.example}" />
The 'best answer' isn't really addressing the problem. The Properties.load() is not the answer as in the case (which is highly likely), you won't control the 'other side' that will be consuming the properties file.
It doesn't appear you can set the <propertyfile/> to not do this. Seems like a bug to me.
The <replace> suggestion seems like the best course of action imo.
I found that when I used the echo task the entry came out as expected\desired in the file.
However, if I ran the propertyfile task afterwards to populate the same file with some values, it escaped all the colons in the file.
To get around this I simply ensured I ran the propertyfile task first, then the echo.
I have a property defined in one of my property files:
<entry key="build" default="0" type="int" operation="+" value="1" />
I read this property using:
<replacefilter token="#build#" property="build_num" />
Once this number gets bigger than 999, thousand separator commas start appearing, like this:
1,001
1,562
Is there a way to get rid of those commas?
(I use build to generate a file name, and don't really want to see any commas in there).
You can prevent thousand separators from being used by adding a pattern to the entry:
<entry key="build" default="0" type="int" operation="+" value="1" pattern="0" />
Note that you'll probably need to manually remove the commas one-time before running this - else your build numbers will reset, with the comma and subsequent digits being discarded. (So 1,325 -> 2 and 4,111 -> 5 and so on.)
Figured ###0 would have worked, but it didn't. Since the project is already making extensive use of ant-contrib, it wasn't difficult to add the regex solution Aaron suggested.
<propertyregex property="build" input="${build}" regexp="," replace="" global="true" override="true"/>