How do I make my speed be positive in any direction?

Hi, I’m making a top down 2d game and I am trying to set up the animations for my game. I currently have a transition from my idle animation to my blend tree for walking. The parameter I am using is speed. It is so when the speed is above 0 it goes to the tree and when it is less than .2 it goes back to the idle state.
The problem is when I walk up the speed goes to one, but when I walk down it goes to -1 and when i go left and right it says at 0. Any help?

Here’s my code

using UnityEngine;
using System.Collections;

public class topdown : MonoBehaviour

    public float moveSpeed;
    private Animator anim;

    public float speed;

    // Use this for initialization
    void Start()
        anim = GetComponent<Animator>();

    // Update is called once per frame
    void Update()
        if (Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < 0.5f)
            transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));

        if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < 0.5f)
            transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));

        anim.SetFloat("speed", Input.GetAxisRaw("Horizontal"));
        anim.SetFloat("speed", Input.GetAxisRaw("Vertical"));

float velocity = Mathf.Abs(new Vector2(Input.GetAxis(“Horizontal”), Input.GetAxis(“Vertical”)).magnitude);
anim.SetFloat(“speed”, velocity);

The idea is to create a 2D vector from the Input axes and get the magnitude/length. You then use Abs(); to flip the negative sign to positive.