Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5510/b4_Business/a2_Strategies/Optimizing/Decoding
Modified Files:
BasicDecoderForTestingPositions.cs
DecoderForTestingPositionsWithBalancedWeights.cs
Log Message:
Modified getWeights method
Index: DecoderForTestingPositionsWithBalancedWeights.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/DecoderForTestingPositionsWithBalancedWeights.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DecoderForTestingPositionsWithBalancedWeights.cs 27 Feb 2008 21:46:15 -0000 1.3
--- DecoderForTestingPositionsWithBalancedWeights.cs 8 Apr 2008 21:46:01 -0000 1.4
***************
*** 51,58 ****
// }
! protected override double[] getWeights()
{
return WeightedPositions.GetBalancedWeights(
! this.decodeSignedTickers(), this.returnsManager );
}
--- 51,58 ----
// }
! protected override double[] getWeights(SignedTickers signedTickers)
{
return WeightedPositions.GetBalancedWeights(
! signedTickers, this.returnsManager );
}
Index: BasicDecoderForTestingPositions.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/BasicDecoderForTestingPositions.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** BasicDecoderForTestingPositions.cs 6 Mar 2008 20:11:38 -0000 1.5
--- BasicDecoderForTestingPositions.cs 8 Apr 2008 21:46:01 -0000 1.6
***************
*** 134,144 ****
#region decodeDecodable
! protected virtual double[] getWeights()
{
//in this implementation encoded doesn't contain
//information for weights: so weights are all the same
double[] weights = new double[this.tickerRelatedGeneValues.Length];
for(int i = 0; i<weights.Length; i++)
! weights[i] = 1.0 / weights.Length;
return weights;
}
--- 134,151 ----
#region decodeDecodable
! protected virtual double[] getWeights(SignedTickers signedTickers)
{
//in this implementation encoded doesn't contain
//information for weights: so weights are all the same
double[] weights = new double[this.tickerRelatedGeneValues.Length];
+ double coefficient;
for(int i = 0; i<weights.Length; i++)
! {
! if(signedTickers[i].IsLong)
! coefficient = 1.0;
! else//is Short
! coefficient = -1.0;
! weights[i] = coefficient / weights.Length;
! }
return weights;
}
***************
*** 156,160 ****
{
SignedTickers signedTickers = this.decodeSignedTickers();
! double[] weights = this.getWeights();
TestingPositions testingPositions =
this.getTestingPositions(
--- 163,167 ----
{
SignedTickers signedTickers = this.decodeSignedTickers();
! double[] weights = this.getWeights(signedTickers);
TestingPositions testingPositions =
this.getTestingPositions(
|