[mlpack-svn] r15617 - in mlpack/conf/jenkins-conf/benchmark: benchmark util
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Aug 14 10:30:05 EDT 2013
Author: marcus
Date: Wed Aug 14 10:30:04 2013
New Revision: 15617
Log:
Add method info section and put the plots into a panel.
Modified:
mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py
mlpack/conf/jenkins-conf/benchmark/benchmark/run_benchmark.py
mlpack/conf/jenkins-conf/benchmark/util/database.py
mlpack/conf/jenkins-conf/benchmark/util/graph.py
mlpack/conf/jenkins-conf/benchmark/util/template.py
Modified: mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/benchmark/make_reports.py Wed Aug 14 10:30:04 2013
@@ -35,7 +35,8 @@
def CreateTopLineChart(db):
build, results = db.GetResultsSum("mlpack")
- GenerateSingleLineChart(results, "reports/img/mlpack_top_" + str(build) + ".png")
+ GenerateSingleLineChart(results, "reports/img/mlpack_top_" + str(build) + ".png",
+ backgroundColor="#F5F5F5")
return "img/mlpack_top_" + str(build) + ".png"
'''
@@ -107,12 +108,29 @@
for result in results:
memoryValues = {}
memoryValues["name"] = result[7]
- memoryValues["content"] = Profiler.MassifMemoryUsageReport(str(result[5]))
- memoryContent += memoryTemplate % memoryValues
+ memoryValues["content"] = Profiler.MassifMemoryUsageReport(str(result[5])).lstrip(" ")
+ memoryContent += panelTemplate % memoryValues
return memoryContent
'''
+Create the method info content.
+
+ at param results - Contains the method information.
+ at param methodName - The name of the method.
+ at return A string that contains the method information HTML code.
+'''
+def CreateMethodInfo(results, methodName):
+ methodInfo = ""
+ if results:
+ infoValues = {}
+ infoValues["name"] = methodName
+ infoValues["content"] =results[0][2].lstrip(" ")
+ methodInfo = panelTemplate % infoValues
+
+ return methodInfo
+
+'''
Create the method container with the informations from the database.
@param db - The database object.
@@ -168,7 +186,10 @@
# Create the timing table.
header, timingTable = CreateTimingTable(timingData, methodLibararies)
- datasetTable = CreateDatasetTable(methodResults)
+ datasetTable = CreateDatasetTable(methodResults)
+
+ # Create the method info content.
+ methodInfo = CreateMethodInfo(db.GetMethodInfo(method[0]), str(method[1:][0]))
# Create the container.
reportValues = {}
@@ -191,6 +212,7 @@
reportValues["timingTable"] = timingTable
reportValues["datasetTable"] = datasetTable
reportValues["memoryContent"] = memoryContent
+ reportValues["methodInfo"] = methodInfo
methodsPage += methodTemplate % reportValues
Modified: mlpack/conf/jenkins-conf/benchmark/benchmark/run_benchmark.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/benchmark/run_benchmark.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/benchmark/run_benchmark.py Wed Aug 14 10:30:04 2013
@@ -207,6 +207,16 @@
Log.Fatal("Exception: " + str(e))
continue
+ # Add method information record.
+ if log:
+ try:
+ methodDescription = instance.description
+ except AttributeError:
+ pass
+ else:
+ if methodDescription and not db.GetMethodInfo(methodId):
+ db.NewMethodInfo(methodId, methodDescription)
+
time = []
for trial in range(trials + 1):
if trial > 0:
Modified: mlpack/conf/jenkins-conf/benchmark/util/database.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/database.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/util/database.py Wed Aug 14 10:30:04 2013
@@ -119,6 +119,20 @@
);
""")
+ '''
+ Create a method information table.
+ '''
+ def CreateMethodInfoTable(self):
+ self.con.executescript("""
+ CREATE TABLE IF NOT EXISTS method_info (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ method_id INTEGER NOT NULL,
+ info TEXT NOT NULL,
+
+ FOREIGN KEY(method_id) REFERENCES methods(id) ON DELETE CASCADE
+ );
+ """)
+
'''
Create a new build, libraries, datasets and results table.
'''
@@ -129,6 +143,7 @@
self.CreateMethodsTable()
self.CreateResultsTable()
self.CreateMemoryTable()
+ self.CreateMethodInfoTable()
'''
Add a new build record to the builds table.
@@ -344,3 +359,25 @@
with self.con:
self.cur.execute("SELECT * FROM memory JOIN datasets ON memory.dataset_id = datasets.id WHERE libary_id=" + str(libaryId) + " AND build_id="+ str(buildId) + " AND method_id=" + str(methodId))
return self.cur.fetchall()
+
+ '''
+ Get the information of the given method.
+
+ @param methodId - The id of the method.
+ @return The informaton of the method.
+ '''
+ def GetMethodInfo(self, methodId):
+ with self.con:
+ self.cur.execute("SELECT * FROM method_info WHERE method_id=" + str(methodId))
+ return self.cur.fetchall()
+
+ '''
+ Add a new method info record to the method_info table.
+
+ @param methodId - The id of the method.
+ @param info - The info for the method.
+ '''
+ def NewMethodInfo(self, methodId, info):
+ with self.con:
+ self.cur.execute("INSERT INTO method_info VALUES (NULL,?,?)",
+ (methodId, info))
Modified: mlpack/conf/jenkins-conf/benchmark/util/graph.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/graph.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/util/graph.py Wed Aug 14 10:30:04 2013
@@ -38,15 +38,15 @@
@param bestlib - The name of the library which should be compared with the other
libraries.
'''
-def GenerateBarChart(results, libraries, fileName, bestlib="mlpack"):
+def GenerateBarChart(results, libraries, fileName, bestlib="mlpack",
+ backgroundColor="#FFFFFF"):
# Bar chart settings.
lineWidth = 0.1
barWidth = 0.15
opacity = 0.9
fill = True
- windowWidth = 11
+ windowWidth = 10.6
windowHeight = 1.5
- backgroundColor = '#F5F5F5'
gridLineWidth = 0.2
# Create figure and set the color.
@@ -165,7 +165,7 @@
# Create the legend under the bar chart.
lgd = ax.legend(chartHandler, legendNames, loc='upper center',
- bbox_to_anchor=(0.5, 1.2), fancybox=True, shadow=False, ncol=8, fontsize=8)
+ bbox_to_anchor=(0.5, 1.3), fancybox=True, shadow=False, ncol=8, fontsize=8)
lgd.get_frame().set_linewidth(0)
for label in lgd.get_texts():
label.set_color("#6e6e6e")
@@ -189,13 +189,12 @@
@param data - List which contains the values for the line chart.
@param fileName - The filename of the line chart.
'''
-def GenerateSingleLineChart(data, fileName):
+def GenerateSingleLineChart(data, fileName, backgroundColor="#FFFFFF"):
# Bar chart settings.
lineWidth = 1.5
opacity = 0.9
- windowWidth = 11
+ windowWidth = 10.6
windowHeight = 1.5
- backgroundColor = '#F5F5F5'
gridLineWidth = 0.2
# Create figure and set the color.
Modified: mlpack/conf/jenkins-conf/benchmark/util/template.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/util/template.py (original)
+++ mlpack/conf/jenkins-conf/benchmark/util/template.py Wed Aug 14 10:30:04 2013
@@ -85,43 +85,53 @@
<a href="#collapseThree" class="btn memory btn-grey icon-paragraph-right-2 js-button"></a>
</div>
</div>
+
<div id="collapseOne" class="container__bottomContent graph collapse">
+
<div>
- <img class="center--image" src="%(lineChart)s" alt="">
+ <img class="panel" src="%(lineChart)s" alt="">
</div>
+
<div>
- <img class="center--image" src="%(barChart)s" alt="">
+ <img class="panel" src="%(barChart)s" alt="">
</div>
+
<div>
- <table class="table table-striped">
- <thead>
- <tr>
- <th></th>
- %(timingHeader)s
- </tr>
- </thead>
- <tbody>
- %(timingTable)s
- </tbody>
- </table>
+ <div class="panel">
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th></th>
+ %(timingHeader)s
+ </tr>
+ </thead>
+ <tbody>
+ %(timingTable)s
+ </tbody>
+ </table>
+ </div>
</div>
</div>
+
<div id="collapseTwo" class="container__bottomContent infos collapse">
<div>
- <table class="table table-striped">
- <thead>
- <tr>
- <th></th>
- <th>Size</th>
- <th>Number of Instances</th>
- <th>Number of Attributes</th>
- <th>Attribute Types</th>
- </tr>
- </thead>
- <tbody>
- %(datasetTable)s
- </tbody>
- </table>
+ <div class="panel">
+ <table class="table table-striped">
+ <thead>
+ <tr>
+ <th></th>
+ <th>Size</th>
+ <th>Number of Instances</th>
+ <th>Number of Attributes</th>
+ <th>Attribute Types</th>
+ </tr>
+ </thead>
+ <tbody>
+ %(datasetTable)s
+ </tbody>
+ </table>
+ %(methodInfo)s
+ </div>
</div>
</div>
@@ -150,12 +160,12 @@
"""
-memoryTemplate = """
+panelTemplate = """
<div class="accordion-group">
<div class="accordion-heading"><a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#%(name)s">%(name)s</a></div>
<div id="%(name)s" class="accordion-body collapse">
<div class="accordion-inner">
- %(content)s
+ <pre>%(content)s</pre>
</div>
</div>
</div>
More information about the mlpack-svn
mailing list