Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N2S3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hammouda Elbez
N2S3
Commits
572c82a0
Commit
572c82a0
authored
3 years ago
by
Elbez Hammouda
Browse files
Options
Downloads
Patches
Plain Diff
updated example class
parent
a7a2b805
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
n2s3_examples/src/main/scala/fr/univ_lille/cristal/emeraude/n2s3/apps/ExampleMnistPrune1Epoch.scala
+20
-16
20 additions, 16 deletions
.../cristal/emeraude/n2s3/apps/ExampleMnistPrune1Epoch.scala
with
20 additions
and
16 deletions
n2s3_examples/src/main/scala/fr/univ_lille/cristal/emeraude/n2s3/apps/ExampleMnistPrune1Epoch.scala
+
20
−
16
View file @
572c82a0
...
...
@@ -50,17 +50,17 @@ object ExampleMnistPrune1Epoch extends App {
var
NeuroneLabels
=
List
[(
Int
,
String
)]()
var
logger
:
SimMongoLog
=
null
var
log
=
false
var
prune
=
fals
e
var
prune
=
tru
e
var
globalIteration
=
6
var
sizeChunk
=
10000
for
(
x
<-
1
to
1
)
{
var
networksizes
=
Array
(
10
,
20
,
50
,
100
,
500
)
for
(
x
<-
4
to
4
)
{
implicit
val
timeout
=
Config
.
longTimeout
alpha
=
ArrAlpha
((
x
-
1
)
/
5
)
beta
=
ArrBeta
((
x
-
1
)
%
5
)
alpha
=
0.05F
beta
=
0.1F
SimName
=
"400
N"
+
"-"
+
x
SimName
=
networksizes
(
x
-
1
)+
"
N"
+
"-"
+
x
println
(
"a:"
+
alpha
+
" b:"
+
beta
)
QBGParameters
.
alf_m
=
0.005f
QBGParameters
.
alf_p
=
0.01f
...
...
@@ -70,6 +70,7 @@ object ExampleMnistPrune1Epoch extends App {
var
iteration
=
0
var
CropInfo
=
""
var
duration
:
Long
=
0L
var
Totalduration
:
Long
=
0L
var
simTime
=
""
var
benchmarkMonitor
:
BenchmarkMonitorRef
=
null
n2s3
=
new
N2S3
(
"N2S3"
)
...
...
@@ -96,7 +97,7 @@ object ExampleMnistPrune1Epoch extends App {
val
unsupervisedLayer
=
n2s3
.
createNeuronGroup
()
.
setIdentifier
(
"OutLayer"
)
.
setNumberOfNeurons
(
400
)
.
setNumberOfNeurons
(
networksizes
(
x
-
1
)
)
.
setNeuronModel
(
LIF
,
Seq
(
(
MembranePotentialThreshold
,
35
millivolts
)))
...
...
@@ -145,9 +146,10 @@ object ExampleMnistPrune1Epoch extends App {
val
dataTestFile
=
N2S3ResourceManager
.
getByName
(
"mnist-test-images"
).
getAbsolutePath
val
labelTestFile
=
N2S3ResourceManager
.
getByName
(
"mnist-test-labels"
).
getAbsolutePath
while
(
iteration
<=
globalIteration
)
{
simTime
=
""
Totalduration
=
System
.
currentTimeMillis
()
while
(
iteration
<=
globalIteration
)
{
unsupervisedLayer
.
unfixNeurons
()
n2s3
.
first
=
false
stream
=
InputMnist
.
DataParts
(
dataFile
,
labelFile
,
sizeChunk
*(
iteration
-
1
),
sizeChunk
)
...
...
@@ -159,22 +161,21 @@ object ExampleMnistPrune1Epoch extends App {
logger
=
new
SimMongoLog
(
n2s3
,
listOfConnexions
,
SimName
.
split
(
"-"
)(
0
),
true
,
true
,
true
,
true
,
"MNIST"
,
SimTime
,
SynapseIndex
)
}
duration
=
System
.
currentTimeMillis
()
simTime
=
"Train "
+
iteration
simTime
=
simTime
+
"Train "
+
iteration
n2s3
.
runAndWait
()
println
(
System
.
currentTimeMillis
()
-
duration
)
simTime
=
simTime
+
" | "
+
(
System
.
currentTimeMillis
()
-
duration
)
+
"\n"
if
(
iteration
==
globalIteration
&&
log
)
{
logger
.
storeSimInfoAndDestroy
()
}
println
(
"saving : "
+
System
.
currentTimeMillis
())
NetworkSaving
.
save
(
n2s3
,
croppedCnx
,
SynapseIndex
,
folderName
+
"/"
+
SimName
+
" Arch "
+
iteration
)
println
(
"end : "
+
System
.
currentTimeMillis
())
println
(
"saving cropped : "
+
System
.
currentTimeMillis
())
saveNeurones
(
unsupervisedLayer
,
"["
+
iteration
+
"]"
)
println
(
"end : "
+
System
.
currentTimeMillis
())
//
println("saving : " + System.currentTimeMillis())
//
NetworkSaving.save(n2s3, croppedCnx, SynapseIndex, folderName + "/" + SimName + " Arch " + iteration)
//
println("end : " + System.currentTimeMillis())
//
println("saving cropped : " + System.currentTimeMillis())
//
saveNeurones(unsupervisedLayer, "[" + iteration + "]")
//
println("end : " + System.currentTimeMillis())
/*
inputStream.append(InputMnist.DataFrom(dataTestFile, labelTestFile))
...
...
@@ -204,6 +205,7 @@ object ExampleMnistPrune1Epoch extends App {
println
(
"cropping : "
+
System
.
currentTimeMillis
())
CropInfo
=
cropNetwork
(
inputLayer
,
Ratio
)
println
(
"end : "
+
System
.
currentTimeMillis
())
simTime
=
simTime
+
"cropped "
+
"["
+
iteration
+
"]"
+
" with "
+
Ratio
+
"\n"
// cropInput(n2s3.inputLayerRef.get, Ratio)
}
...
...
@@ -229,7 +231,7 @@ object ExampleMnistPrune1Epoch extends App {
NetworkSaving
.
save
(
n2s3
,
croppedCnx
,
SynapseIndex
,
folderName
+
"/"
+
SimName
+
" Arch "
+
iteration
+
" cropped"
)
benchmarkMonitor
.
exportToHtmlView
(
folderName
+
"/"
+
"test cropped "
+
SimName
+
" ["
+
iteration
+
"]"
+
".html"
)
simTime
=
simTime
+
"Total time: "
+
(
System
.
currentTimeMillis
()
-
Totalduration
)
+
"\n"
benchmarkMonitor
.
saveCrops
(
folderName
+
"/"
+
"Sim "
+
SimName
+
" info a:"
+
alpha
+
" b:"
+
beta
,
simTime
,
CropInfo
+
" Ratio "
+
Ratio
)
}
if
(
iteration
==
globalIteration
&&
log
)
{
...
...
@@ -238,7 +240,9 @@ object ExampleMnistPrune1Epoch extends App {
iteration
+=
1
}
}
//logger.destroy()
n2s3
.
destroy
()
sys
.
exit
(
0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment