<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jun 11, 2012, at 05:50 , Steven Nunez wrote:</div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: verdana, helvetica, sans-serif; font-size: 11px; "><div style="display: block; ">(defun algorithm-name (model)</div><div style="display: block; ">  "Returns the algorithm for the model"</div><div style="display: block; ">  (stp:filter-recursively (stp:of-name "algorithmName" (stp:namespace-uri model)) model))</div></span></span><br class="Apple-interchange-newline"></blockquote></div><br><div>I'd do something like the following:</div><div><br></div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><div>(defun algorithm-name (model)</div><div>  (xpath:with-namespaces ((nil "<a href="http://www.dmg.org/PMML-4_0">http://www.dmg.org/PMML-4_0</a>"))</div><div>    (xpath:string-value (xpath:evaluate "//RegressionModel/@algorithmName" model))))</div><div><br></div><div>(defun model-coefficient-list (model)</div><div>  (xpath:with-namespaces ((nil "<a href="http://www.dmg.org/PMML-4_0">http://www.dmg.org/PMML-4_0</a>"))</div><div>    (let ((regression-model-node (xpath:first-node (xpath:evaluate "//RegressionModel" model)))</div><div>          (*read-eval* nil))</div><div>      `(,(xpath:string-value (xpath:evaluate "@modelName" regression-model-node))</div><div>        ,@(xpath:map-node-set->list</div><div>           (lambda (node)</div><div>             (list</div><div>              (xpath:string-value (xpath:evaluate "@name" node))</div><div>              ;; note: xpath:number-value may work here, depending on</div><div>              ;; your implementation... does not work with Lispworks</div><div>              ;; 6.1 under Mac OS X</div><div>              (read-from-string (xpath:string-value (xpath:evaluate "@coefficient" node)))))</div><div>           (xpath:evaluate "RegressionTable/NumericPredictor" regression-model-node))))))</div><div><br></div><div>#||</div><div>(defparameter *model*</div><div>  (cxml:parse #p"/Users/raw/Desktop/polynomial-regression.xml" (cxml-stp:make-builder)))</div><div><br></div><div>(cxml-stp:serialize *model* (cxml:make-string-sink :indentation 4))</div><div><br></div><div>(algorithm-name *model*)</div><div><br></div><div>(model-coefficient-list *model*)</div><div>||#</div></div><div><div>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div><div><br></div><div><br></div><div>Notes:</div><div><br></div><div>1) I'm not sure that model-coefficient-list does what you need.</div><div><br></div><div>2) It might be appropriate to use cxml-stp:attribute-value instead of xpath:string-value/xpath:evaluate.</div><div><br></div><div>3) Since there are multiple coefficients with the same name (where some have an "exponent" attribute), I guess you'd either need to filter out some of the coefficients, build names that somehow incorporate the exponent, or add the exponent to the list structure returned.</div><div><br></div><div>Hope this helps.</div><div></div></div></body></html>