Help

Oct 10, 2010 at 11:53 PM

Need help using the library? Post your question here.

Jun 27, 2011 at 12:12 PM
Hello. I really need help here! When I run the code:


using System;
using Google.API.Predict;
using Google.API.Predict.Requests;
using Google.API.Predict.Responses;

namespace GooglePredictionTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "Using Google Prediction API in .NET";

            // Authorization
            GooglePredictionClient client = new GooglePredictionClient("myemail@googlemail.com", "password", "bucket", "data.csv");

            // Retrieving the authorization key
            Console.WriteLine(string.Format("Your authorization key is:\n{0}", client.ClientLogin.Auth));
            Console.WriteLine("");

            // Training
            TrainingResponse trainingResponse = new TrainingResponse();
            trainingResponse = client.Train();
            if (trainingResponse.Success)
                Console.WriteLine("Training succeeded.");
            else
                Console.WriteLine(string.Format("Training faild: {0}.", trainingResponse.ResponseStatusCodeDescription));
            Console.WriteLine("");

            // Deleting the training model
            DeleteResponse deleteResponse = new DeleteResponse();
            deleteResponse = client.Delete();
            if (deleteResponse.Success)
                Console.WriteLine("Delete succeeded.");
            else
                Console.WriteLine(string.Format("Delete faild: {0}.", deleteResponse.ResponseStatusCodeDescription));
            Console.WriteLine("");

            // Changing the training model
            client.ChangeData("bucket", "data2.csv");
            trainingResponse = client.Train();
            if (trainingResponse.Success)
                Console.WriteLine("Training succeeded.");
            else
                Console.WriteLine(string.Format("Training faild: {0}.", trainingResponse.ResponseStatusCodeDescription));
            Console.WriteLine("");

            // Checking the status of training
            MetadataResponse metaResponse = new MetadataResponse();
            metaResponse = client.Check();
            Console.WriteLine(metaResponse.ModelInfo);

            // Create the prediction
            NumericPrediction<int> numericInt = new NumericPrediction<int>(19, 29, 34, 45);

            // Request a prediction and store the result
            PredictionResponse prediction = new PredictionResponse();
            prediction = client.PredictNumeric(numericInt);

            // Print the results to the console
            Console.WriteLine("Prediction:" + prediction.OutputValue);
        }
    }
}


I get the following result:

Your authorization key is:DQAAAPUAAAC-A8BTMKhTJTTRcKRFQBThAiloxYPOofvvGhmUByhK9v4C9qynGf99YD4hkpNLwPQH3DaXL_GYxY_cZj4Qd9v6OauJZxZbnmDgYuWoUOycaE7BMT0x31ct_zNPyob9TXxqcNqkZOAD5zogdMWlu4czYst4YrlNriJWti1jtCHRS3EIc4_AagAsKt6jyKyMT6mAUrMzBnBoDbMoHsOr3ryG89HBTGth7AS6tlmWKqnOaiGMegYub_Z7xHz7RncPBtLIcWD5wE3rEoR6KfhXgReLpo9nz-FC77nqgx7SB5RIFX_xS9_DlQozaUpD1NfSvokOmgBvNJ0JeLP65QwbR5U9
Training faild: Unauthorized.
Delete faild: Unauthorized.
Training faild: Unauthorized.

Prediction:


I really don't know where the problem lies because I have access to both Google Storage for Developers and Google Prediction API. What am I doing wrong?? 
Jul 27, 2011 at 11:03 AM

I got the exact same problem :-(

Does anyone know if it is caused by the API not supporting Oauth 2.0?

 

Jul 27, 2011 at 7:51 PM

Yes, it is caused by the API not supporting Oauth 2.0. I haven't set aside the time to get oauth 2.0 implemented. Check back mid-August and I may have something done. If anyone would like to help please send me a message!

Jul 29, 2011 at 2:38 PM
Thanks a lot for your fast reply.

I am afraid I am not that use-full when it comes to writing dll's / API's.

I'm pretty old-school (learned to code on the C64 / A500 back the good old days), so I have never learned to write system architecture level code for Windows that well. Today I mostly work with statistics / data-modelling, but use C# and SQL / MySQL when working with big data.

But I will try to talk to some of my colleges / friends. Some of them might have time to help out. I will let you know if one them is interested.

Thanks again for your help - and have a nice weekend :-)

Best regards
Henrik Lauritzen
UserReport.com

Mobile: +45 60 19 24 35
Mail: henrik@userreport.com

Svanevej 12
2400 Copenhagen NV
Denmark



On 27 July 2011 20:51, ajparise <notifications@codeplex.com> wrote:

From: ajparise

Yes, it is caused by the API not supporting Oauth 2.0. I haven't set aside the time to get oauth 2.0 implemented. Check back mid-August and I may have something done. If anyone would like to help please send me a message!

Read the full discussion online.

To add a post to this discussion, reply to this email (gpapi@discussions.codeplex.com)

To start a new discussion for this project, email gpapi@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Aug 29, 2011 at 10:03 AM

Hi,

It's now late August. Any update on when the API may support OAuth 2.0?

Sep 1, 2011 at 8:36 PM

Nothing new yet :(