A fast LibSVM data format reader for Common Lisp
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
LICENCE.txt
README.org
cl-libsvm-format-test.asd
cl-libsvm-format.asd

README.org

Cl-Libsvm-Format

http://quickdocs.org/badge/cl-libsvm-format.svg https://travis-ci.org/masatoi/cl-libsvm-format.svg?branch=master

A fast LibSVM data format reader for Common Lisp.

Installation

ros install masatoi/cl-libsvm-format

Usage

SVMFORMAT:PARSE-FILE returns the dataset list and the estimated number of dimensions of the data. One datum is a list in which the first element is a class label or a target of regression, and the rest are alternate with the index and its value.

(ql:quickload :cl-libsvm-format)

(multiple-value-bind (dataset dim)
    (svmformat:parse-file "/home/wiz/datasets/mnist.scale")
  (defparameter mnist-dataset dataset)
  (defparameter mnist-dimension dim))

;;; First datum

(car mnist-dataset)
;; (5 153 0.0117647005 154 0.0705882 155 0.0705882 156 0.0705882 157 0.494118 158
;;  0.533333 159 0.686275 160 0.101961 161 0.65098 162 1.0 163 0.968627 164
;;  0.498039 177 0.117647 178 0.141176 179 0.368627 180 0.603922 181 0.666667 182
;;  0.992157 183 0.992157 184 0.992157 185 0.992157 186 0.992157 187 0.882353 188
;;  0.67451 189 0.992157 190 0.94901997 191 0.764706 192 0.25098 204 0.192157 205
;;  0.933333 206 0.992157 207 0.992157 208 0.992157 209 0.992157 210 0.992157 211
;;  0.992157 212 0.992157 213 0.992157 214 0.984314 215 0.364706 216 0.321569 217
;;  0.321569 218 0.219608 219 0.152941 232 0.0705882 233 0.858824 234 0.992157 235
;;  0.992157 236 0.992157 237 0.992157 238 0.992157 239 0.776471 240 0.713725 241
;;  0.968627 242 0.945098 261 0.313725 262 0.611765 263 0.419608 264 0.992157 265
;;  0.992157 266 0.803922 267 0.0431373 269 0.168627 270 0.603922 290 0.054902 291
;;  0.00392157 292 0.603922 293 0.992157 294 0.352941 320 0.545098 321 0.992157
;;  322 0.745098 323 0.00784314 348 0.0431373 349 0.745098 350 0.992157 351
;;  0.27451 377 0.137255 378 0.945098 379 0.882353 380 0.627451 381 0.423529 382
;;  0.00392157 406 0.317647 407 0.941176 408 0.992157 409 0.992157 410 0.466667
;;  411 0.0980392 435 0.176471 436 0.729412 437 0.992157 438 0.992157 439 0.588235
;;  440 0.105882 464 0.0627451 465 0.364706 466 0.988235 467 0.992157 468 0.733333
;;  494 0.976471 495 0.992157 496 0.976471 497 0.25098 519 0.180392 520 0.509804
;;  521 0.717647 522 0.992157 523 0.992157 524 0.811765 525 0.00784314 545
;;  0.152941 546 0.580392 547 0.898039 548 0.992157 549 0.992157 550 0.992157 551
;;  0.980392 552 0.713725 571 0.094117604 572 0.447059 573 0.866667 574 0.992157
;;  575 0.992157 576 0.992157 577 0.992157 578 0.788235 579 0.305882 597 0.0901961
;;  598 0.258824 599 0.835294 600 0.992157 601 0.992157 602 0.992157 603 0.992157
;;  604 0.776471 605 0.317647 606 0.00784314 623 0.0705882 624 0.670588 625
;;  0.858824 626 0.992157 627 0.992157 628 0.992157 629 0.992157 630 0.764706 631
;;  0.313725 632 0.0352941 649 0.215686 650 0.67451 651 0.886275 652 0.992157 653
;;  0.992157 654 0.992157 655 0.992157 656 0.956863 657 0.521569 658 0.0431373 677
;;  0.533333 678 0.992157 679 0.992157 680 0.992157 681 0.831373 682 0.529412 683
;;  0.517647 684 0.0627451)

;;; Number of features

mnist-dimension ; => 780

Author

Satoshi Imai (satoshi.imai@gmail.com)

Licence

This software is released under the MIT License, see LICENSE.txt.