Forum Replies Created
- AuthorPosts
JD Kromkowski
Participantsorry for careless use of word “float”, when maybe I meant double or long double.
We don’t really have a type like DECIMAL(n,2) or DECIMAL (n,4). Do we? SB may have stored in float or double or long double, but when we search (do comparisions) we never had the problem of not finding the correct record. So what am I supposed to do? To do it correctly in SBNG.
JD Kromkowski
ParticipantThis a version of the axiom: never store things in float unless you are a physist looking for the Higgs Boson.
So what is the solution? Again?
JD Kromkowski
Participantis this floating math which I always forget and then remember every 4 years. https://docs.python.org/release/2.5.1/tut/node16.html
If so there is still a problem when working with databases. If I search or set a filter for mydata.myfield == 20513.24 I need to find that record! even if 24/100 in binary is some other number (invisibly really close).
JDK
JD Kromkowski
ParticipantYeah. So…we make math.h part of the C components of SIMPOL?
JD Kromkowski
ParticipantUse “File>Import” in Personal
Or is the actual code important? I don’t think that it is currently available to public but probably uses fsfileinputstream
JD Kromkowski
Participant//Regression John Kromkowski 5/2/2017
//Beginnings need to add routine for equation/constant, etc.function main()
string s, s1, sfieldnameX,sfieldnameY
number Rsquared
sbme1 sbme
integer e, error, count1, count2
sbme1table tablename
sbme1field sbfieldX,sbfieldY
boolean found
array b
b =@ array.new()s = “”
count1 = 4
count2 = 0
e = 0
error = 0
sbme =@ sbme1.new(“C:\SIMPOL\Ethnic\ARHE\cdancestry.sbm”, “O”, error=e)
if sbme =@= .nul
s = “Error number ” + .tostr(e, 10) + ” opening the SBME file: ‘cdancestry.sbm'{d}{a}”
else
tablename =@ sbme.opentable(“CDANSCESTRY”, error=e)
if e
s = “Error number ” + .tostr(e, 10) + ” opening the table{d}{a}”
else
// Initialize the found flag to .false
found = .false
b =@ getfieldinfoarray(tablename)
while count1 < 158
sfieldnameX = b[4]
sfieldnameY = b[count1]
sbfieldX =@ getfield(tablename,sfieldnameX)
sbfieldY =@ getfield(tablename,sfieldnameY)
Rsquared = regression(sbfieldX, sbfieldY)
s = sfieldnameX + ” – ” + sfieldnameY + ” R-squared: ”
s1 = .tostr(Rsquared,10)
wxmessagedialog(message = s + s1)
count1 = count1 + 1
end while
end if
end if
end function sfunction regression(sbme1field sbfieldX, sbme1field sbfieldY)
array x, y, xy, x2, y2
x =@ array.new()
y =@ array.new()
xy=@ array.new()
x2=@ array.new()
y2=@ array.new()
number Pearson, Rsquared, numer, denom
number sumX,sumY, sumXY, sumX2, sumY2
integer i, n
sbme1record r
i = sbfieldX.table.recordcount()
n = i
r =@ sbfieldX.table.select(lastrecord=.false)x = .fix(r.get(sbfieldX),1000000)
y = .fix(r.get(sbfieldY),1000000)
xy = .fix(r.get(sbfieldX),1000000) * .fix(r.get(sbfieldY),1000000)
x2 = raisetopower(x,2)
y2 = raisetopower(y,2)
while i > 1
r =@ r.select(previousrecord = .false)
i = i – 1
x = .fix(r.get(sbfieldX),1000000)
y = .fix(r.get(sbfieldY),1000000)
xy = .fix(r.get(sbfieldX),1000000) * .fix(r.get(sbfieldY),1000000)
x2 = raisetopower(x,2)
y2 = raisetopower(y,2)
end while
sumX = sumarray(x)
sumY = sumarray(y)
sumXY = sumarray(xy)
sumX2 = sumarray(x2)
sumY2 = sumarray(y2)
numer = ((n*sumXY)-(sumX*sumY))
denom = sqrt(((n*sumX2)-raisetopower(sumX,2))*((n*sumY2)-raisetopower(sumY,2)),14)
Pearson = .fix(numer/denom,1000000000)
Rsquared = raisetopower(Pearson,2)
end function Rsquaredfunction sumarray(array data)
number sum
integer count, i
count = data.count()
i = 1
sum = 0
while
sum = sum + data
i = i+1
end while (i > count)
end function sumJD Kromkowski
ParticipantI’ve started writing a regression function. I’d like to make it GUI. Is there code already available for a picking fields (like field selection dialog in personal) that I could have? The function I’m writing basically takes fieldA and fieldB and outputs the regression equation and R squared.
function regression(sbmefield fieldA, smbefield fieldB)
…
end function RegressionInfoJD Kromkowski
ParticipantBefore I write correlation, regression, r^2, etc stuff. These haven’t already been written have they? I am getting tired of exporting to spreadsheets and want to automate to reduce dimensionality in a dataset.
My niece and nephews think I should learn R for machine learning, but it seems like SBNG could do the stuff.
Might also be another market for SBNG?JD Kromkowski
ParticipantThanks for consideration.
JD Kromkowski
ParticipantGreat. Thanks. SD too? Because that is really more useful than Variance. Although, you have to calc variance to get to SD.
If I’m greedy, which I am, I’d love UCL and LCL (upper control limit and lower control limit) which is Mean +/- 3*SD!
JDK
JD Kromkowski
ParticipantThanks Neil. I will take a look.
What exactly is “formnode”.
JD Kromkowski
ParticipantSort of related. I’d like
1) to change sort order on detail block on fly – I know I wrote code in SB to do this but can’t find where and obviously needs to be done slightly differently in SIMPOL. Any code out there?
2) Searching through detailblocks, like the filtergui. In SB, I’d do the search and then load a dialog with list to choose from basically what the filtergui does but only applied to the currently linked detailblock data. Before I go do a rabbit hole – what has been the consensus or thoughts on how best to do this.
January 31, 2017 at 7:02 pm in reply to: Moving from from standa lone app to networked multi-user app (from SBME to PPCS #3481JD Kromkowski
ParticipantI see how the code works now.
January 30, 2017 at 9:30 pm in reply to: Moving from from standa lone app to networked multi-user app (from SBME to PPCS #3477JD Kromkowski
ParticipantSo this code in Simpol Business has some issues for me.
me.inifilename = datadir + sAPPNAME + “.ini”
buf = openinifile(me.inifilename, sCRLF)
s = “”
getprivateprofilestring(sSYSTEM, sUSEPPCS, “F”, s, sEOLchar=sCRLF, sInifilecontent=buf)
if s == “T”
//So my ini looked like this but obvious you can have “.true” you have to have “T”
//[System]
//useppcs=.true <—- will fail
//serveraddress=10.1.10.xx:4000 not really xx, but you get idea
//useppcs = .true
else
useppcs = .false
end ifif useppcs
serveraddressport = “”
//
// I don’t get the point of the ini, if you end up putting having to put the
// the ip address in the actual code
//
//getprivateprofilestring(sSYSTEM, sSERVERADDRESS,”127.0.0.1:4000″, serveraddressport, sEOLchar=sCRLF, sInifilecontent=buf)// shouldn’t it be like this:
getprivateprofilestring(sSYSTEM, sSERVERADDRESS, serveraddressport, serveraddressport, sEOLchar=sCRLF, sInifilecontent=buf)- This reply was modified 9 years, 8 months ago by
JD Kromkowski.
JD Kromkowski
ParticipantInno setup 2.0? Aren’t they on version 5. Is there something about 2.0 than makes it better? I’ve never used an installer.
- This reply was modified 9 years, 8 months ago by
- AuthorPosts
