Neural Network POC limited output range - neural-network

To keep this as brief as possible, I have implemented a Neural Network in Java that originally was written as just an example of XOR.
This works great, so I moved on to a proof of concept on loading up the input's/output's of the NN. I've changed the algorithm to take in binary and read what number its suppose to be seeing. with 2 bits, or 3 bits as the input, I can get great results with the expected output.
-- --> 0.000
-O --> 1.000
O- --> 2.000
OO --> 3.000
and
--- --> 0.000
--O --> 1.000
-O- --> 2.000
-OO --> 3.000
O-- --> 4.000
O-O --> 5.000
OO- --> 6.000
OOO --> 7.000
Now, once I increase the bits input / output expected number to 4, I begin to run into problems.
---- --> 0.985
---O --> 0.985
--O- --> 3.160
--OO --> 3.160
-O-- --> 4.990
-O-O --> 4.990
-OO- --> 6.747
-OOO --> 6.747
O--- --> 8.094
O--O --> 8.094
O-O- --> 9.696
O-OO --> 9.696
OO-- --> 12.531
OO-O --> 12.531
OOO- --> 14.395
OOOO --> 14.395
What is the conceptual reason for this to occur? I have tried all types of hidden layer sizes and layer numbers with no difference in results.
I will output one more larger result.
----- --> 2.515
----O --> 2.515
---O- --> 2.515
---OO --> 2.515
--O-- --> 6.598
--O-O --> 6.598
--OO- --> 6.598
--OOO --> 6.598
-O--- --> 10.241
-O--O --> 10.241
-O-O- --> 10.241
-O-OO --> 10.241
-OO-- --> 14.364
-OO-O --> 14.364
-OOO- --> 14.364
-OOOO --> 14.364
O---- --> 18.190
O---O --> 18.190
O--O- --> 18.190
O--OO --> 18.190
O-O-- --> 22.319
O-O-O --> 22.319
O-OO- --> 22.319
O-OOO --> 22.319
OO--- --> 26.824
OO--O --> 26.824
OO-O- --> 26.824
OO-OO --> 26.824
OOO-- --> 30.966
OOO-O --> 30.966
OOOO- --> 30.966
OOOOO --> 30.966
As you can see, its possible to calculate the apparent "bunching" going on.
Thanks for any help!

Well, the answer came down to the number of bits in my response. Long story short, if you are using 1 output neuron for an integer expected output, the data type's number of bits is the output range...
The fix is output neuron return type's number of bits (Float 32, Double 64) is the range you should not exceed.
For my training set's expected results, I just ran a conversion of numberYouWant/maxNumberTheResultYouWantTheNetworkToBe * outputsDataSize
Basically, get it to count to 32 or 64 really well, and make any number system fit into that.
Thanks for no help :)

Related

multi-column template for Cleverreach

I'm trying to write a multi-column template for Cleverreach. We need a one-column for the main-content and below this a two- or three-column area for products (dynamic content from MyContent-API).
All my tries dosn't work, it's seems only possible to define one-column areas (loop-areas) for placing content-elements in Cleverreachs WYSIWYG-editor.
If I define more than one loop-areas, only the last area is displayed in WYSIWYG-editor, alls others are gone.
Has someone resolved such a problem? Somthing like:
<table><tr><td><!-- #loop# --> <!-- #/loop# --></td>
<td><!-- #loop# --> <!-- #/loop# --></td></tr></table>
(this example will result in, that only the second column is displayed in WYSIWYG-editor.
Kind regard
Johannes
It#s important, that each loop has a unique numerous ID
<table>
<tr>
<td>
<!-- #loop# --> <!-- loop1 -->
some code
<!--#/loop# -->
</td>
<td>
<!-- #loop# --> <!-- loop2 -->
some other code
<!-- #/loop# -->
</td>
</tr>
</table>

No DataSerializerFactory registered for namespace: 0 - hazelcast 3.5.5

I'm using hazelcast- 3.5.5 and hazelcast-client - 3.5.5. As per the documentation it was fixed in 3.4.x, but I'm still facing this issue in 3.5.5.
Here is my code:
val hazelcastConfig = new XmlConfigBuilder(System.getProperty("hazelcast.config")).build()
hazelcastConfig.setClassLoader(getClass.getClassLoader)
config.getSerializationConfig().addSerializerConfig(sc);
val instance :HazelcastInstance= Hazelcast.newHazelcastInstance(hazelcastConfig)
Below is my hazelcast.xml
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--<group>-->
<!--<name>devtestme</name>-->
<!--<password>dev-passtestme</password>-->
<!--</group>-->
<!--<management-center enabled="false">http://localhost:3210/mancenter</management-center>-->
<network>
<port auto-increment="false" port-count="100">5701</port>
<outbound-ports>
<!--
Allowed port range when connecting to other nodes.
0 or * means use system provided port.
-->
<ports>0</ports>
</outbound-ports>
<join>
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
<tcp-ip enabled="true">
<member-list>
<member>myip1</member>
<member>myip2</member>
</member-list>
<!--<interface>myip1 </interface>-->
</tcp-ip>
<aws enabled="false">
<access-key>my-access-key</access-key>
<secret-key>my-secret-key</secret-key>
<!--optional, default is us-east-1 -->
<region>us-west-1</region>
<!--optional, default is ec2.amazonaws.com. If set, region shouldn't be set as it will override this property -->
<host-header>ec2.amazonaws.com</host-header>
<!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
<security-group-name>hazelcast-sg</security-group-name>
<tag-key>type</tag-key>
<tag-value>hz-nodes</tag-value>
</aws>
</join>
<!--<interfaces enabled="false">-->
<!--<interface>10.10.1.*</interface>-->
<!--</interfaces>-->
</network>
<map name="user_id">
<map-store enabled="true">
<!--
Name of the class implementing MapLoader and/or MapStore.
The class should implement at least of these interfaces and
contain no-argument constructor. Note that the inner classes are not supported.
-->
<class-name>myclass</class-name>
<!--
Number of seconds to delay to call the MapStore.store(key, value).
If the value is zero then it is write-through so MapStore.store(key, value)
will be called as soon as the entry is updated.
Otherwise it is write-behind so updates will be stored after write-delay-seconds
value by calling Hazelcast.storeAll(map). Default value is 0.
-->
<write-delay-seconds>0</write-delay-seconds>
<!--
Used to create batch chunks when writing map store.
In default mode all entries will be tried to persist in one go.
To create batch chunks, minimum meaningful value for write-batch-size
is 2. For values smaller than 2, it works as in default mode.
-->
<write-batch-size>1</write-batch-size>
</map-store>
</map>
<map name="boolean_cache">
</map>
<map name="inapp_templates">
<map-store enabled="true">
<!--
Name of the class implementing MapLoader and/or MapStore.
The class should implement at least of these interfaces and
contain no-argument constructor. Note that the inner classes are not supported.
-->
<class-name>myclass</class-name>
<!--
Number of seconds to delay to call the MapStore.store(key, value).
If the value is zero then it is write-through so MapStore.store(key, value)
will be called as soon as the entry is updated.
Otherwise it is write-behind so updates will be stored after write-delay-seconds
value by calling Hazelcast.storeAll(map). Default value is 0.
-->
<write-delay-seconds>0</write-delay-seconds>
<!--
Used to create batch chunks when writing map store.
In default mode all entries will be tried to persist in one go.
To create batch chunks, minimum meaningful value for write-batch-size
is 2. For values smaller than 2, it works as in default mode.
-->
<write-batch-size>1</write-batch-size>
<!--
Remove after the idle time
-->
</map-store>
</map>
Below is the error I'm getting when I'm trying to connect to two machines
WARNING: [ip]:7060 [devtestme] [3.5.5] hz._hzInstance_1_devtestme.IO.thread-in-1 Closing socket to endpoint null, Cause:com.hazelcast.nio.serialization.HazelcastSerializationException: No DataSerializerFactory registered for namespace: 0
#4000000056e9be5d36796194 com.hazelcast.nio.serialization.HazelcastSerializationException: No DataSerializerFactory registered for namespace: 0
#4000000056e9be5d36796194 at com.hazelcast.nio.serialization.DataSerializer.read(DataSerializer.java:98)
#4000000056e9be5d3679d6c4 at com.hazelcast.nio.serialization.DataSerializer.read(DataSerializer.java:39)
#4000000056e9be5d3679daac at com.hazelcast.nio.serialization.StreamSerializerAdapter.read(StreamSerializerAdapter.java:41)
Can someone please help me to fix this, I have spent a lot of time on this. Thanks in advance.
I have a mergeStrategy for jackson libraries in my build.sbt. Removing it has resolved the issue.

XPath: what's the different between "begin with one slash" and "begin with 2 slashes"?

I read some Xpath code, some begin with "/xxxx", some begin with "//xxxx". What're their differences? Do they have different behavior just in "Select" or different also in other behaviors?
I didn't find corresponding explanations on this site, any hints?
Thanks.
Beginning an XPath with one slash will retrieve the root of the document, so that /xxxx will match only the <xxxx> element that is the root of the XML.
Example:
<?xml version="1.0"?>
<xxxx> <!-- this one will match -->
<level>
<xxxx /> <!-- this one won't -->
</level>
</xxxx>
Whereas //xxxx will match all <xxxx> elements anywhere in the document.
Example:
<?xml version="1.0"?>
<xxxx> <!-- this one will match -->
<level>
<xxxx /> <!-- this one will match as well -->
<sublevel>
<xxxx /> <!-- and also this one -->
</sublevel>
</level>
</xxxx>

Accessing customer contact details with QBSDK

According to the QBSDK v12 and v13 OSR documentation, the SDK returns contact details (phone, email, etc.) for each of the contacts associated with a customer. In other words, tags within the contact. But when I query a customer that has multiple contacts associated with it, all I get is:
<Contact>Thing One</Contact> (for the contact flagged as primary)
<AltContact>Thing Two</AltContact> (for the contact flagged as secondary)
<AdditionalContactRef>
<ContactName>Main Phone</ContactName> (the main phone # for CUSTOMER, not contact)
<ContactValue>425-555-1212</ContactValue>
</AdditionalContactRef>
etc...
The phone # and email set up for each contact is not included in the response XML. This is with QB Premier 2014 and QBSDK v13. Am I missing something, or does QB not yet return the contact details, which are supposedly supported by the SDK?
If I understand the question correctly, you are looking for the ContactsRet element.
You should be able to request ContactsRet element using the IncludeRetElement element.
From the OSR:
<CustomerRet>
<ContactsRet> <!-- optional, may repeat -->
<ListID> IDTYPE </ListID> <!-- required -->
<TimeCreated> DATETIMETYPE </TimeCreated> <!-- required -->
<TimeModified> DATETIMETYPE </TimeModified> <!-- required -->
<EditSequence> STRTYPE </EditSequence> <!-- required -->
<Contact> STRTYPE </Contact> <!-- optional -->
<Salutation> STRTYPE </Salutation> <!-- optional -->
<FirstName> STRTYPE </FirstName> <!-- required -->
<MiddleName> STRTYPE </MiddleName> <!-- optional -->
<LastName> STRTYPE </LastName> <!-- optional -->
<JobTitle> STRTYPE </JobTitle> <!-- optional -->
<AdditionalContactRef> <!-- must occur 0 - 5 times -->
<ContactName>STRTYPE</ContactName> <!-- required -->
<ContactValue>STRTYPE</ContactValue> <!-- required -->
</AdditionalContactRef>
</ContactsRet>
</CustomerRet>

Writing a DTD: How to achieve this children setup

The element tasklist may contain at most one title and at most one description, additionally any number (incl. 0) task elements in any order.
The naive approach is not applicable, since the order should not matter:
<!ELEMENT tasklist (title?, description?, task*) >
Alternatively, I could explicitly name all possible options:
(title, description?, task*) |
(title, task+, description?, task*) |
(task+, title, task*, description?, task*) |
(description, title?, task*) |
(description, task+, title?, task*) |
(task+, description, task*, title?, task*) |
(task*)
but then it's quite easy to write a non-deterministic rule, and furthermore it looks like the direct path to darkest madness. Any ideas, how this could be done more elegantly?
And no, an XSD or RelaxNG is no option. I need a plain, old DTD.
This summarises what you need:
<!ELEMENT tasklist (task*, ((title?, task*, description?) |
(description?, task*, title?)), task*)>
Alternation for the title appearing before/after description.
However, this is not a deterministic content model, as #13ren explains in his answer. [Here is another example from Microsoft](http://msdn.microsoft.com/en-us/library/9bf3997x(VS.71).aspx).
In short
Your requirements is to have a non-deterministic model, and as such, there is no possible valid DTD for your scenario.
Alternatives
If you place a simple restriction that either task or description must be the last element if both task and description are provided, you can use this deterministic DTD declaration:
<!ELEMENT tasklist (
task*,
((title, task*, description?) |
(description, task*, title?))?
)>
Examples:
<!-- Valid -->
<tasklist>
<task></task>
<task></task>
<task></task>
<title></title>
<task></task>
<description></description>
</tasklist>
<!-- Valid -->
<tasklist>
<title></title>
<task></task>
<task></task>
<task></task>
</tasklist>
<!-- Invalid
<tasklist>
<task></task>
<title></title>
<task></task>
<description></description>
<task></task>
</tasklist>
-->
Or, possibly more naturally, enforce that a title or description element must be the first element, and both title and description elements must exist or be non-existent.
<!ELEMENT tasklist (
((title, task*, description) |
(description, task*, title))?,
task*
)>
Examples:
<!-- Valid -->
<tasklist>
<title></title>
<task></task>
<description></description>
<task></task>
<task></task>
</tasklist>
<!-- Invalid
<tasklist>
<task></task>
<title></title>
<description></description>
<task></task>
<task></task>
</tasklist>
<tasklist>
<title></title>
<task></task>
<task></task>
<task></task>
</tasklist>
-->
Otherwise
Otherwise, you need to use RELAX NG, which allows for non-deterministic models.
Why is the order unimportant?
It seems to me as if the order is rather a bit important right here; and that the only sensible order is title?, description?, task*.
Flexibility is nice and all, but sometimes it's just not neccessary.