DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone >

Useful Normalizing Functions (php)

Snippets Manager user avatar by
Snippets Manager
·
Jan. 17, 07 · · Code Snippet
Like (0)
Save
Tweet
1.43K Views

Join the DZone community and get the full member experience.

Join For Free
useful normalizing functions for transfer of data into a neural net safe array (0-1) or for fitting data for a graph etc..

can also be used in reverse by using the array largest and least values.


= 0 && $stop <= count($stack) 1){ // limit recursion to bounds.
    if (is_in_rorder_key($check2)){
        $check =  $check2;
        $begin = $start-1; $ending = $stop;        
        $check3 = section_greedy($start-1, $stop 1); //recurse up
        if(is_in_rorder_key($check3)){
            $check = $check3;
            $moremore = section_greedy($start, $stop 1); //recurse down
            if(is_in_rorder_key($moremore)){
                $check =  $moremore;
                $begin = $start-2; $ending = $stop 2;
            }//fi
        }//fi
    }else{
        $check =  array_slice_key($stack, $start, $stop);
        $begin = $start; $ending = $stop;
    }//fi
    }//fi
    return $check;
}//end function

/*
returns an array of movements up/down and the change.
Array(
    [down] => 1178.36
    [up] => 419.05
    [change] => -759.31
)
*/
function examine_movement($arr){
    while(list($key,$val) = each($arr)){
        if($oldval == ""){$oldval = $val;}
        if($val > $oldval){
            $ret[up] += $val-$oldval;
        }else{
            $ret[down] += $oldval-$val;
        }
        $oldval = $val;        
    }//wend
    $ret[change] = $ret[up] - $ret[down];
    return $ret;
}

?>

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Minimize Software Development Cost
  • After COVID, Developers Really Are the New Kingmakers
  • Upsert in SQL: What Is an Upsert, and When Should You Use One?
  • Top 20 Git Commands With Examples

Comments

Partner Resources

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo