Example #1
0
 /**
  * makePowerRegression
  * 
  * Factory function to return a regression object set up to perform
  * regressions against data fitted with the equation
  * 
  *     y = a * x1^b1 * x2^b2 * ... * xn^bn
  * 
  * @return static
  */
 public static function makePowerRegression(RegressionAlgorithmInterface $regressionStrategy = null)
 {
     $regression = Regression::makePowerRegression($regressionStrategy);
     $simple = new static();
     $simple->regression = $regression;
     return $simple;
 }
Example #2
0
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Exakat.  If not, see <http://www.gnu.org/licenses/>.
 *
 * The latest code can be found at <http://exakat.io/>.
 *
*/
include '/Users/famille/.composer/vendor/autoload.php';
use mcordingley\Regression\Regression;
use mcordingley\Regression\RegressionAlgorithm\LinearLeastSquares;
$files = glob('projects/*');
$fp = fopen('timing.csv', 'w+');
fputcsv($fp, array('project', 'initialSize', 'size', 'buildRoot', 'tokenizer', 'analyze', 'final'));
$total = 0;
//$regression = new Regression(new LinearLeastSquares);
$regression = new Regression();
foreach ($files as $id => $file) {
    unset($project, $initialSize, $size, $buildRoot, $tokenizer, $analyze, $final);
    list(, $project) = explode('/', $file);
    if (in_array($project, array('test'))) {
        continue;
    }
    if (!file_exists("projects/{$project}/log/project.timing.csv")) {
        print "{$project}\n";
        continue;
    }
    $content = file_get_contents("projects/{$project}/log/project.timing.csv");
    if (!preg_match("#Tokenizer\t([0-9\\.]+)#is", $content, $r)) {
        continue;
    }
    $tokenizer = $r[1];