something wrong in wx
I wrote program training na Artificial Neural Network. It work well in
console mode, but when I try to add GUI there is an error:
FANN Error 10: Error reading info from train data file "zapis.txt" , line: 2
There is a code:
##### this work ############
#!/usr/bin/python
import fann
connection_rate = 1
learning_rate = 0.7
num_layers = 3
num_input = 319
num_neurons_hid den = 50
num_output = 5
ann = fann.fann_creat e(connection_ra te, learning_rate, num_layers,num_ input,
num_neurons_hid den, num_output)
desired_error = 0.00001
max_iterations = 500000
iterations_betw een_reports = 1000
fann.fann_train _on_file(ann, "zapis.txt" , max_iterations,
iterations_betw een_reports, desired_error)
print fann.fann_get_M SE(ann)
fann.fann_save( ann, "po_nauce.n et")
fann.fann_destr oy(ann)
######### with GUI (not work) #########
#!/usr/bin/python
import wx
import fann
class TestFrame(wx.Fr ame):
def __init__(self):
wx.Frame.__init __(self, None, -1, "Trenowanie sieci", pos=(50, 50))
panel = wx.Panel(self)
# First create the controls
topLbl = wx.StaticText(p anel, -1, "Trenowanie sieci", size=wx.Size(40 0,
21), style=wx.ALIGN_ CENTRE)
topLbl.Center(w x.HORIZONTAL)
topLbl.SetFont( wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
polaczenia_Lbl = wx.StaticText(p anel, -1, u'Stopie\u0144
po\u0142\u0105c ze\u0144 [%]:')
self.polaczenia = wx.SpinCtrl(pan el, -1, "")
self.polaczenia .SetRange(0,100 )
self.polaczenia .SetValue(100)
ilosc_warstw_Lb l = wx.StaticText(p anel, -1, u'Ilo\u015b\u01 07 warstw:')
self.ilosc_wars tw = wx.SpinCtrl(pan el, -1, "")
self.ilosc_wars tw.SetRange(0,5 )
self.ilosc_wars tw.SetValue(3)
cstLbl1 = wx.StaticText(p anel, -1, '\n'
u'Poszczeg\xf3l ne warstwy sieci: ')
cstLbl = wx.StaticText(p anel, -1, '\n'
u'wej\u015biowa ukryta wyj\u015biowa')
self.ilosc_wejs c = wx.SpinCtrl(pan el, -1, "")
self.ilosc_wejs c.SetRange(0,20 00)
self.ilosc_wejs c.SetValue(319)
self.ukryte = wx.SpinCtrl(pan el, -1, "")
self.ukryte.Set Range(0,500)
self.ukryte.Set Value(50)
self.ilosc_wyjs c = wx.SpinCtrl(pan el, -1, "")
self.ilosc_wyjs c.SetRange(0,10 0)
self.ilosc_wyjs c.SetValue(5)
uczenie_Lbl = wx.StaticText(p anel, -1, u'Cz\u0119sto\u 015b\u0107 uczenia
[%]:')
self.uczenie = wx.SpinCtrl(pan el, -1, "")
self.uczenie.Se tRange(0,100)
self.uczenie.Se tValue(70)
oczekiwany_blad _Lbl = wx.StaticText(p anel, -1, u'Oczekiwany
b\u0142\u0105d: [1/x]')
self.oczekiwany _blad = wx.SpinCtrl(pan el, -1, "")
self.oczekiwany _blad.SetRange( 0,100000000)
self.oczekiwany _blad.SetValue( 100000)
powtorzen_Lbl = wx.StaticText(p anel, -1, u'Maxymalna liczba
powt\xf3rze\u01 44:')
self.powtorzen = wx.SpinCtrl(pan el, -1, "")
self.powtorzen. SetRange(0,1000 00)
self.powtorzen. SetValue(50000)
raporty_Lbl = wx.StaticText(p anel, -1, u'raport co:')
self.raporty = wx.SpinCtrl(pan el, -1, "")
self.raporty.Se tRange(0,10000)
self.raporty.Se tValue(1000)
trenujBtn = wx.Button(panel , -1, "Trenuj Siec")
self.Bind(wx.EV T_BUTTON, self.on_trenujB tn, trenujBtn)
cancelBtn = wx.Button(panel , -1, "Cancel")
# Now do the layout.
# mainSizer is the top-level one that manages everything
mainSizer = wx.BoxSizer(wx. VERTICAL)
mainSizer.Add(t opLbl, 0, wx.ALL, 5)
ainSizer.Add(wx .StaticLine(pan el), 0, wx.EXPAND|wx.TO P|wx.BOTTOM, 5)
# addrSizer is a grid that holds all of the address info
addrSizer = wx.FlexGridSize r(cols=2, hgap=5, vgap=5)
addrSizer.AddGr owableCol(1)
addrSizer.Add(p olaczenia_Lbl, 0, wx.ALIGN_RIGHT| wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(s elf.polaczenia, 0, wx.EXPAND)
addrSizer.Add(i losc_warstw_Lbl , 0, wx.ALIGN_RIGHT|
wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(s elf.ilosc_warst w, 0, wx.EXPAND)
#addrSizer.Add( (10,10)) # some empty space
#addrSizer.Add( addr2, 0, wx.EXPAND)
addrSizer.Add(c stLbl1, 0, wx.ALIGN_RIGHT| wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(c stLbl, 0, wx.ALIGN_RIGHT| wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(( 10,10)) # some empty space
# the city, state, zip fields are in a sub-sizer
cstSizer = wx.BoxSizer(wx. HORIZONTAL)
cstSizer.Add(se lf.ilosc_wejsc, 1)
cstSizer.Add(se lf.ukryte, 0, wx.LEFT|wx.RIGH T, 5)
cstSizer.Add(se lf.ilosc_wyjsc)
addrSizer.Add(c stSizer, 0, wx.EXPAND)
addrSizer.Add(u czenie_Lbl, 0, wx.ALIGN_RIGHT| wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(s elf.uczenie, 0, wx.EXPAND)
addrSizer.Add(o czekiwany_blad_ Lbl, 0, wx.ALIGN_RIGHT|
wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(s elf.oczekiwany_ blad, 0, wx.EXPAND)
addrSizer.Add(p owtorzen_Lbl, 0, wx.ALIGN_RIGHT| wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(s elf.powtorzen, 0, wx.EXPAND)
addrSizer.Add(r aporty_Lbl, 0, wx.ALIGN_RIGHT| wx.ALIGN_CENTER _VERTICAL)
addrSizer.Add(s elf.raporty, 0, wx.EXPAND)
# now add the addrSizer to the mainSizer
mainSizer.Add(a ddrSizer, 0, wx.EXPAND|wx.AL L, 10)
# The buttons sizer will put them in a row with resizeable
# gaps between and on either side of the buttons
btnSizer = wx.BoxSizer(wx. HORIZONTAL)
btnSizer.Add((2 0,20), 1)
btnSizer.Add(tr enujBtn)
btnSizer.Add((2 0,20), 1)
btnSizer.Add(ca ncelBtn)
btnSizer.Add((2 0,20), 1)
mainSizer.Add(b tnSizer, 0, wx.EXPAND|wx.BO TTOM, 10)
# Finally, tell the panel to use the sizer for layout
panel.SetSizer( mainSizer)
# Fit the frame to the needs of the sizer. The frame will
# automatically resize the panel as needed. Also prevent the
# frame from getting smaller than this size.
mainSizer.Fit(s elf)
self.SetSizeHin ts(*self.GetSiz e())
def on_trenujBtn(se lf, event):
connection_rate = float(self.pola czenia.GetValue ()*0.01)
learning_rate = float(self.ucze nie.GetValue()* 0.01)
num_layers = int(self.ilosc_ warstw.GetValue ())
num_input = int(self.ilosc_ wejsc.GetValue( ))
num_neurons_hid den = int(self.ukryte .GetValue())
num_output = int(self.ilosc_ wyjsc.GetValue( ))
ann = fann.fann_creat e(connection_ra te, learning_rate, num_layers,
num_input, num_neurons_hid den, num_output)
max_iterations = int(self.powtor zen.GetValue())
iterations_betw een_reports = int(self.raport y.GetValue())
desired_error = 0.00001 #float(1/(self.oczekiwan y_blad.GetValue ()))
print desired_error
fann.fann_train _on_file(ann, "zapis.txt" , max_iterations,
iterations_betw een_reports, desired_error)
fann.fann_save( ann, "po_nauce.n et")
fann.fann_destr oy(ann)
app = wx.PySimpleApp( )
frame = TestFrame()
frame.Show()
app.MainLoop()
############### ############### ############### ##########
Thanks for any help.
Robert 4 2230
Robert <To*****@2kop.m il.pl> wrote: something wrong in wx
I doubt it.
I wrote program training na Artificial Neural Network. It work well in console mode, but when I try to add GUI there is an error: FANN Error 10: Error reading info from train data file "zapis.txt" , line: 2
How are you launching the GUI version? Are you double-clicking on an icon
somewhere? Are you sure the application is starting in the correct
directory -- the one that contains zapis.txt?
Perhaps you should try hard-code the full path, or at least doing an
os.chdir().
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Dnia Sun, 13 Nov 2005 08:29:49 +0000, Tim Roberts napisa³(a): I wrote program training na Artificial Neural Network. It work well in console mode, but when I try to add GUI there is an error: FANN Error 10: Error reading info from train data file "zapis.txt" , line: 2 How are you launching the GUI version? Are you double-clicking on an icon somewhere?
I launch the Gui version with terminal.
# python Training.py
Are you sure the application is starting in the correct directory -- the one that contains zapis.txt?
Yes i'm sure.
Perhaps you should try hard-code the full path, or at least doing an os.chdir().
it still doesn't work.
Thanks.
Don't know if this will help or not because it seems like a strange
error if this is the problem. I've always had to run my wxPython apps
with pythonw, otherwise it will give you an error saying it needs the
GUI interpreter or something like that. However, this could be an
operating system specific codition. If that doesn't fix anything all I
can say is check and recheck your path.
Sorry to be of no help and to raise another question.
How did you manage to get fann going under python?
I can install fann 1.2.0 allright but something doesn't go with the
python setup.
(I run Python 2.4.1 under linux 2.6.13)
When trying to run a small example in python I always get error
messages about missing definitions in _libfann.
I have read about supposed disultils problems and workarounds, but I
didn't manage yet.
Thank you for any suggestion,
malv This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Luka Milkovic |
last post by:
Hello,
I have a little problem and although it's little it's extremely difficult
for me to describe it, but I'll try.
I have written a program which extracts certain portions of my received
e-mail. The content of the e-mail is actually predictable, it has one very
long list of numbers, something looking like this:
|
by: Steve |
last post by:
Hi, Is there something fundamentally wrong with the following query?
SELECT MAX(OrderID) AS Expr1 FROM Orders WHERE (MarketActionCode = 'S') AND
(OrderLegCode = 'S') AND (Status = 'F') AND (AttemptID IN (SELECT AttemptID
FROM ATTEMPT WHERE EventID = ?))
I pass in the EventID (in this case 1). the query returns the correct
OrderID when I test it in sql2000 but for some reason fails to return a
value when I use Java code. There is...
|
by: uberderf |
last post by:
I have the following web page setup:
http://angels.uberderf.com/glossary.html
I have a 2 column table layout which is a glossary of terms and their
meanings.
When you view this page in firefox the first row displays with a lot of
space below the two cells. The rest of the table looks as it was
intended to look. This same page viewed in Mozilla looks correct or how
it was intended to look. Even IE displays the page as intended.
|
by: Vandana Rola |
last post by:
Hello Everyone,
I posted this question earlier under creating Multiple choice quiz. Is
it possible to ignore something using javascript. What I am trying to
do is creating a multiple answer quiz. I have five choices out of
which user are supposed to choose 3 best choices. The user should get
feedback on the choices they make. I have been able to provide the
feedback for all the choices but my problem is I am also getting the
feedback on...
|
by: Michael Sparks |
last post by:
Hi,
I suspect this is a bug with AMK's Crypto package from
http://www.amk.ca/python/code/crypto , but want to
check to see if I'm being dumb before posting a bug
report.
I'm looking at using this library and to familiarise myself writing
small tests with each of the ciphers. When I hit Crypto.Cipher.ARC4 I've
| |
by: matsi.inc |
last post by:
I am looking to make something like a delegate that i can use in my
projects but am having a hard time getting started.
The behavior I am most interested in is how a delegate changes it's
Invoke method dynamically to match the arguments supplied to it when it
is defined. For example...
public delegate void MyDelegate(string myString, int myInt);
|
by: Simon Brooke |
last post by:
This is supposed to be a very simple XSL stylesheet to strip styling
information out of HTML documents - it could not be more basic. And yet,
it doesn't work. I'm obviously getting something very basic wrong and for
the life of me I can't see it. Please, somebody, cast your eyes over this
and tell me what's wrong!
First, the XSL stylesheet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
|
by: Jon Slaughter |
last post by:
I have some code that loads up some php/html files and does a few things to
them and ultimately returns an html file with some php code in it. I then
pass that file onto the user by using echo. Of course then the file doesn't
get seen by the user.
Is there any command that essentially executes the code and then echo's it?
something that will take a string like
'<body>blah<?php echo 'Hello'; ?></body>' and actually interpret the php
|
by: Peter Oliphant |
last post by:
It's not necessary, but it would be nice if there was a way I could easily
create something like a 'web browser form' or a 'display web page form' as
forms in my application (in a Panel would be even better!). Something that
allows browsing the internet within the window, or possibly just display a
web page that I choose (as the application author in code) to show without
the ability to browse. The later ability would allow me to change,...
|
by: raphfrk |
last post by:
This program should copy one file onto the other. It works if I
compile it with gcc to a cygwin program. However, if I compile it
with the -mno-cygwin option, it doesn't work (this targets native
windows).
Anyway, I just want to check that the program is valid before I see if
I can find a way around a compiler bug.
It might be something simple that I am doing wrong.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |