Learning your fretboard is a long term process, but you can speed things up considerably by practicing arpeggios-"broken" chords, in which the notes are played in succession ( rather than simultaneously) . Playing arpeggios will help you master various chord fingerings, and will give you a working foundation in chord theory, which is one of the cornerstones of improvisation.
The arpeggios given here are major triads with their relative minor triads, for the keys of, C, F, Bb, Eb, and Ab. Notice that the key of C has no accidentals (sharps or flats), and that the remaining keys are all "flat" keys.
Naturally, there are several fingerings for any arpeggio. I consider the ones shown here to be the easiest, starting in the lowest position and spanning two octaves.
Several of the arpeggios require considerable position shifts (as in F, Eb, Fm) in which the first finger shifts up five frets. Other shifts (as in Dm, Bb, Cm) are more subtle.
Repeat each arpeggio until it becomes familiar to you, playing first with downstrokes for each note, and then with successive upstroke/downstroke alternations. Say (or think) the name of each note as you play it, and try to hear the relationships of the notes in the chords. Have fun!